0

Hi all i need to create a form to upload two files to a specified folder that is created by the selection of a select and an input on the same page.

So the form must have:
input type="text"
select
upload image on the folder "select_value/input_value/random_name_image.jpg"
upload file on the folder "select_value/input_value/random_name_file.txt"

someone can help me to create this form? thanks a lot

2
  • i don't know how to do this form. How to upload the files to the specified folder Commented Oct 19, 2010 at 10:39
  • 2
    Related: Handling file uploads in the PHP manual - it's a bit dry, but has a full working example Commented Oct 19, 2010 at 10:41

1 Answer 1

1

Something like this:

// Build destination path from the text input and select
$dest = ...;

if (!move_uploaded_file($_FILES['image']['tmp_name'], "{$dest}/{$_FILES['image']['name']}")) {
  echo('Error with image');
  die();
}
if (!move_uploaded_file($_FILES['file']['tmp_name'], "{$dest}/{$_FILES['file']['name']}")) {
  echo('Error with image');
  die();
}

Check out move_uploaded_file() for more information. Make sure your form has enctype="multipart/form-data" specified (major waste of time if you forget that).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.