How do I let users upload files to a chosen location?

I found some plugins which let me make my own forms but none worked for different reasons.

I simply want to make a form so that users can upload files to a folder located in www.chusmix.com/images

Read More

I’m trying this code, but it sends me to a “page not found”:

<form enctype="multipart/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>

Thanks

Related posts

Leave a Reply

1 comment

  1. In PHP, instead of:

    <form method="POST" action="url">
    

    Use this instead:

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

    You can then fetch the resulting files using the $_FILES superglobal.


    In WP 3.1, the whole uploads infrastructure should be available as an API unless I’m mistaking. But it won’t necessarily work on the front end, let alone allow you to easily decide where the files go.

    You could use parts of it to validate file types, etc., though. See the stuff in:

    • wp-includes/media.php
    • wp-admin/includes/media.php