
August 11th, 2004, 05:33 PM
|
|
Contributing User
|
|
Join Date: Apr 2002
Location: Anchorage
Posts: 118
Time spent in forums: < 1 sec
Reputation Power: 7
|
|
|
Multi-upload not going working
I have been trying to run a multiple upload script, but I'm having trouble getting it to work.
Here is the code...
I think one problem is Where I am trying to copy the files. It worked when I just had a simple single upload script.
* This is the first page, the number of upload possibilities is set at 5.
PHP Code:
<?
//start the form
$uploadNeeded = 5;
for ($x=0; $x<$uploadNeeded;$x++) {
?>
<input name="uploadFile <? echo $x; ?>" type="file" id="uploadFile <? echo $x; ?>">
</p>
<?
//end of for loop
}
?>
<p>
<input name="uploadNeeded" type="hidden" value="<? echo $uploadNeeded; ?>">
<input type="submit" name="Submit" value="Upload">
</p>
</form>
* This is the second page that uploads the first form.
PHP Code:
$uploadNeeded = $_POST[ 'uploadNeeded'];
// start for loop
for($x=0; $x<$uploadNeeded; $x++){
$file_name = $_FILES['uploadFile'. $x]['name'];
//strip file name of slashes
$file_name = stripslashes($file_name);
$file_name = str_replace("'","",$file_name);
$copy = copy($_FILES['uploadFile'. $x]['tmp_name'], "../uploadworkfolder/"$foldername"/"$file_name);
//check if successfully copied
if($copy) {
echo "$file_name | uploaded successfully!<br>";
} else {
echo "$file_name | could not be uploaded, check file name and kind.<br>";
}
}
//end of loop
The $copy line may the be problem, I can't seem to copy to that dir.
This script was modified from Johnathan's script.
Any help appreciated.
R.
__________________
bow wow!
|