Jump to content

upload extract


shage

Recommended Posts

<?php
if ($_POST['action'] == 'add')
{
$rand = rand(100,999);

mkdir('zipfiles/'.$rand.'');
$upload_folder = 'zipfiles/'.$rand.'/';
$upload_factsheets = str_replace("'", "", $upload_folder.$rand.$_FILES['fs']['name']);
if (move_uploaded_file($_FILES['fs']['tmp_name'], $upload_factsheets))
{
system('unzip "'.$upload_factsheets.'"');
print $upload_factsheets;
}
else
{
print "<script>alert ('There was a problem with your file');</script>";
}
}

?>
<form method="post" enctype="multipart/form-data">
<input name="fs" type="file" class="style11normblack" id="fs" />
<input name="Submit" type="submit" class="style11normblack" value="Add" />
<input name="action" type="hidden" id="action" value="add" />
</form>

 

 

it uploads file but doesnt unzip in folder but unzips in folder where script is

Link to comment
https://forums.phpfreaks.com/topic/83484-upload-extract/
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.