Jump to content

File Uploader


Spixxx

Recommended Posts

My friend posted about this and said his post was gone the next day...so I helped him with $i++;, but he never got this answered, and Im using the same script...

[code]
<?php

$number="5";

$directory ="upload/";
if ($_POST){
for ($i=0;$i<$number;$i++){

if (trim($_FILES['myfiles']['name'][$i])!=""){

$newfile = $directory.$_FILES['myfiles']['name'][$i];

move_uploaded_file($_FILES['myfiles']['tmp_name'][$i], $newfile);

$j++;

}

}

}

if (isset($j)&&$j>0){

ACTION HERE

}

echo "<form method='post' enctype='multipart/form-data'>";


for($i=0;$i<$number;$i++){

echo "<input type='file' name='myfiles[]' size='30'><br>";}


echo "<input type='submit' name='action' value='Upload'>";

echo "</form>";

?>
[/code]

Few questions:

1) What would "ACTION HERE" be if I wanted to echo a _blank link to each of the newly uploaded files?
2) How could I make a form to specify a number 1-9, and use that in place of $number? And continue w/ rest of form
3) How could I make a dropdown with different directory names to upload the file(s) into? (i.e. ../images, .current folder, ../images/something)
Link to comment
https://forums.phpfreaks.com/topic/5254-file-uploader/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.