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
是否可以使用简单的输入文本框和插入按钮以cdn上传图像?我必须在这个项目中使用经典的asp和SQL。我需要一个输入框,我必须在单击插入按钮后输入需要上传到cdn的图像名称。此外,我需要使文件可重命名。我知道如何在服务器上传图像,但不能在cdn中上传。我对cdn知之甚少。任何形式的帮助都非常值得赞赏
<input type=text name=inputtxt> <input type=submit name=submit value="INSERT" class=inputitem>
1 个解决方案
#1
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.
要在AWS S3上存储文件,您需要向AWS发出HTTP请求。一种方法是使用来自Chilkat的ASP对象。
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!
希望这能帮助你走上正轨 - 祝你好运!
#1
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.
要在AWS S3上存储文件,您需要向AWS发出HTTP请求。一种方法是使用来自Chilkat的ASP对象。
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!
希望这能帮助你走上正轨 - 祝你好运!