php upload file script transcipted in asp
I have the following form:
<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidde开发者_开发百科n" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
for the uploader.php, where the file is uploaded, here is the code:
$target_path = "uploads/";
$target_path = $target_path . basename( $HTTP_POST_FILES['uploadedfile']['name']);
if(copy($HTTP_POST_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
As i intend to move this code to IIS, can you help rewrite the uploader.php code to translate it to asp so that I can change in my form the action to 'uploader.asp' ? If it's not possible, how can I do it with web services?
Thank you,
Regards
Not sure if you tried even searching for ASP related 'form / upload' content.. very easy to find:
http://www.asp101.com/resources/aspupload.asp
<HTML>
<BODY>
<%
Set Upload = Server.CreateObject("Persits.Upload.1")
Count = Upload.Save("c:\upload")
%>
<% = Count %> files uploaded.
</BODY>
</HTML>
It is a simple upload form, plenty of examples. Check out the link do a search as well for reference, SO is not for someone doing the work for you. It is for getting answers to questions/problems you are stuck on.
精彩评论