pqina / filepond

🌊 A flexible and fun JavaScript file upload library
https://pqina.nl/filepond
MIT License
15.16k stars 825 forks source link

How to get uploaded temp-images to upload folder #222

Closed jonasneustupny closed 5 years ago

jonasneustupny commented 5 years ago

Hi. I´m sorry, my question is kind of basic, but I´m stuck.

Uploading a file to the temp-folder works well. But I don´t understand point number 5 in the upload process:

  1. client submits the FilePond parent form containing the hidden input field with the unique id

How???? If I do a $('#form').submit() on the form with the hidden filepond-input, nothing happens.

Can someone please give me a hint? I didn´t find a full example of an implementation with jquery (and php).

rikschennink commented 5 years ago
<form method="POST" action="submit.php">
    <div class="filepond--root"><!-- FilePond and its hidden input fields live here --></div>
    <button type="submit">Submit</button>
</form>

When you upload a file (using the server property) the server returns (should return) a unique id for that file so you can identify the file in your backend when (and if) the form is submitted later on (in this case the submit button is clicked). The form submit will post a list of unique file ids to your server.

It's not required, you could deal with only temp files, but I find this is a nice way of confirming the user has made a definite selection and has confirmed it by submitting the form.

jonasneustupny commented 5 years ago

Hi @rikschennink, I did get the submitting part to work now. Thank you for the explanation!

I thought there was a function that would call a server-process to move the files from the temp folders to the target directory. I was wondering why the config.php has the constant UPLOAD_DIR in it since it won´t be used.

rikschennink commented 5 years ago

It’s also imported by another file, I believe submit.php which uses it to move the file

rikschennink commented 5 years ago

@jonasneustupny Please close the issue if the original problem has been resolved.