Hello there,
I am trying to upload 2 files, the first one is a flash (.swf) file and the second a .png.
At the moment, I would have no problem making 2 different php upload file, with 2 different forms, but Im sure there can be a way to make that all together.
I am not really experimented with PHP, but Im trying to learn.
At the moment I have this:
<?php
$allowed_filetypes = array('.swf','.png');
$max_filesize = 10524288;
$upload_path = 'swf/';
$filename = $_FILES['userfile']['name'];
$ext = substr($filename, strpos($filename,'.'), strlen($filename)-1);
if(!in_array($ext,$allowed_filetypes))
die('The file you attempted to upload is not allowed.');
if(filesize($_FILES['userfile']['tmp_name']) > $max_filesize)
die('The file you attempted to upload is too large.');
if(move_uploaded_file($_FILES['swf']['tmp_name'],$upload_path . $filename))
echo 'Your file upload was successful, view the file <a href="' . $upload_path . $filename . '" title="Your File">here</a>';
else
echo 'An unknown error occured, try again.';
?>
Ok so this is part of the code I found online, with that Im using a simple upload form.
How could I go and put 2 forms on the same page, and the 2 forms upload separately to 2 different folders, in example .png goes to icons/ folder and .swf goes to swf/ folder?
All that with only one button, that will also post other stuff.
Any help would be really appreciated!!