开发者

How do I make an upload file form to my blog?

I want to upload the files to this address: http://chusmix.com/Imagenes/grupos and I'm trying with this simple this code but it doesn't work:

<form enctype="mul开发者_Python百科tipart/form-data" method="post" action="http://chusmix.com/Imagenes/grupos">

Please specify a file:<br>
<input type="file" name="datafile" size="40">
</p>
<div>
<input type="submit" value="Send">
</div>
</form>


Oddly enough, the first result of a Google search yielded this rather helpful tutorial. Why not read it?


Read the PHP manual chapter "Handling file uploads":

http://php.net/manual/en/features.file-upload.php

The way you think uploads work is not the way they work. The form posts to the script you want to handle the request, not the location you want the uploads to be. When you upload a file to Apache, it places that file in the temporary directory of the computer (in Linux, that's /tmp by default).

Your script has to move the file from the temp directory to wherever you want it to be. The manual has plenty of code showing you how.


Make sure the form is loaded via
http://chusmix.com/Imagenes
The browsers wont you allow to upload to a unkown website (Same origin policy).

Edit your form

<form enctype="multipart/form-data" method="post" action="/grupos">
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜