Page 1 of 1
how i save uploded file??
Posted: Tue Dec 02, 2003 2:24 pm
by pink
hi every one
i think a have a selly proplam
i have a php code
to upload a file
when i uploded the file correctly how could i save it ??
thank you !
Posted: Tue Dec 02, 2003 3:50 pm
by DuFF
If you uploaded it successfully then you must have defined an upload directory for the file to go into. It should be in whatever folder you indicated in the script.
If you are not sure what I mean, please post the script so we can look at the code.
Posted: Tue Dec 02, 2003 4:38 pm
by pink
hii again
unfourtinally i couldn't understsnd you very will
so this is my code :
Code: Select all
<?php
<?php
if ($_POST && $_FILES)
{
$wanted_type = "application/vnd.ms-excel";
$wanted_size = "51200";
$file_type = $_FILES["myfile"]["type"];
$file_size = $_FILES["myfile"]["size"];
if ($file_type != $wanted_type)
{
$i++;
print "<li>error, file type doesn't match</li>";
}
if ($file_size < $wanted_size)
{
$i++;
print "<li>error, file size is bigger then allowed</li>";
}
if (!$i || $i<=0)
{
print "go on";
}
}
?>
<form method="post" enctype="multipart/form-data">
<input type="file" name="myfile" size="40"><br>
<input type="submit" name="action" value="Upload!">
</form>
?>
so how could i indicat the directory

Posted: Tue Dec 02, 2003 5:25 pm
by m3mn0n
Click: [google]php file upload tutorial[/google]
Posted: Tue Dec 02, 2003 5:50 pm
by DuFF
Is this correct?
Code: Select all
<?php
if ($file_size < $wanted_size)
{
$i++;
print "<li>error, file size is bigger then allowed</li>";
}
?>
Right now thats checking if the $file_size is less then the $wanted_size, it should be:
Code: Select all
<?php
if ($file_size > $wanted_size)
{
$i++;
print "<li>error, file size is bigger then allowed</li>";
}
?>