1

Is it possible to upload images in cdn using a simple input text box and a insert button? I have to use classic asp and SQL for this project. I need to have a input box in which I have to type the name of the image which need to be uploaded into cdn after clicking insert button. Also, I need to make the file renameable. I know how to upload images in the server but not in cdn. As I know very few about cdn. Any kind of help is really appreciat

<input type=text name=inputtxt>&nbsp;&nbsp;<input type=submit name=submit value="INSERT" class=inputitem>
LouManizer
  • 51
  • 1
  • 8

1 Answers1

0

To store a file at AWS S3 you will need to make HTTP requests to AWS. One way is using the http object for ASP from Chilkat.

I found this code here (which is untested!) but illustrates nicely the principle behind it:

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' Create http object
set http = Server.CreateObject("Chilkat_9_5_0.Http")

success = http.UnlockComponent("Anything for 30-day trial")
If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( http.LastErrorText) & "</pre>"

End If

'  Insert your access key here:
http.AwsAccessKey = "ABQXXABC83ABCDEFVQXX"

'  Insert your secret key here:
http.AwsSecretKey = "XXXXYYYYabcdABCD12345678xxxxyyyyzzzz"

bucketName = "yourbucket"

objectName = "mypicture.jpg"

localFilePath = "mypicture.jpg"

contentType = "image/jpg"

success = http.S3_UploadFile(localFilePath,contentType,bucketName,objectName)

If (success <> 1) Then
    Response.Write "<pre>" & Server.HTMLEncode( http.LastErrorText) & "</pre>"
Else
    Response.Write "<pre>" & Server.HTMLEncode( "File uploaded.") & "</pre>"
End If


%>
</body>
</html>

Hope this helps you to get on the right track - Good luck!

Steven M
  • 574
  • 4
  • 20
  • This would presumably mean that the Chilcat upload component would need to be installed on the server - is that an option with AWS? – John Jan 10 '16 at 12:39
  • My understanding is that he has his own web server and wants to upload files to AWS. In that case he needs any type of ActiveX that gives him http calls. – Steven M Jan 10 '16 at 17:22