Hi guys,
I have to create an uploader which is supposed to upload whole directories. Is there any way that to be done? I am thinking of using Php and Flash?
Thanks.
Folder upload
Moderator: General Moderators
Re: Folder upload
as far as I know whole directories cann't be uploaded once unless it is zipped.
Here is a code for file upload
and upload_file.php to process file uploading
Here is a code for file upload
Code: Select all
<form action="upload_file.php" method="post" enctype="multipart/form-data">
<!-- MAX_FILE_SIZE (measured in bytes)must precede the file input field -->
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
<label for="file">Filename:</label>
<input type="file" name="file" id="file" />
<br />
<input type="submit" name="submit" value="Submit" />
</form>Code: Select all
if ($_FILES["file"]["error"] > 0)
{
echo "Error: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
echo "Type: " . $_FILES["file"]["type"] . "<br />";
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
echo "Stored in: " . $_FILES["file"]["tmp_name"];
if (file_exists("upload/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
}- Ollie Saunders
- DevNet Master
- Posts: 3179
- Joined: Tue May 24, 2005 6:01 pm
- Location: UK
PHP will accept multiple files at once so the only obstacle is providing a decent interface to the user. With pure HTML you can only provide a series of <input type="file"> fields. I think there are flash embeds that will do a better job failing that you should look to the domain of the "Java Applet". I've seen them used on Facebook photo uploading pages.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact: