HTML Upload Form will only upload files found in the directory of the PHP file.

Posted by vette982 on Stack Overflow See other posts from Stack Overflow or by vette982
Published on 2010-04-12T21:00:34Z Indexed on 2010/04/12 21:03 UTC
Read the original article Hit count: 369

Filed under:
|
|
|
|

I have an image uploader that uses the imgur.com API and jQuery's .ajax() function to upload images to their servers. However, if I browse for an image using the <input type="file"/> element of the form, it will only be successful in uploading an image if the image file is found in the same directory as the page.php file that the form is found in (shown below). How can I allow the form to upload images from any directory on my computer?

page.php:

<form action="page.php" method="post">
    <input type="file" name="doc" id="doc" /><br/>
    <input type="image" src="go.gif" name="submit" id="submit" />
</form>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about imgur