Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

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

share|improve this question

1 Answer 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
share|improve this answer
    
Hi Denis. Look I tried this using your that code: '<form enctype="multipart/form-data" method="post" action="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> ' I have to put the url I wants the files to be uploaded where it says url right? I did that and changed the folder permission to be publicly modifiable with filezilla but I'm not getting them online. I still feel I'm very close... Do I need to add anything else or what? –  Lisandro Dec 11 '10 at 21:29
    
I copied the code above so it's more clear. –  Lisandro Dec 11 '10 at 21:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.