The html file
<html>
<head><title> Form Uploading </title></head>
<body>
<h3>File upload </h3>
Select a File <BR />
<Form action ="upload.php" method = "post" enctype="multipart/form-data">
<input type="file" name ="file" sieze = "50" >
<input type ="submit" value = "Upload File">
</form>
<body>
</html>
The php file
<?php
if($_FILES[ 'file'][ 'name' ] != ""){
copy ( $_FILES[ 'file'][ 'name' ], "C:\Users\Acasa\Desktop".$_FILES[ 'file'][ 'name' ]) ;#or
#die( "Could not copy file!");
echo $_FILES[ 'file'][ 'name' ];
}else{
echo "Sent File".$_FILES[ 'file' ][ 'name']."<BR />";
echo "Size File".$_FILES[ 'file' ][ 'size']."<BR />";
echo "Type File".$_FILES[ 'file' ][ 'type']."<BR />";
}
?>
Both are in the same dir.
I want to try the code from tutorialspoint.com but for some reason it`s not working... I want to copy the uploaded file into another dir they used function copy and not move_uploaded_file
Any suggestion why it`s not working?
error_reporting. It'll give you two hints here.move_uploaded_filewith$_FILES['file']['tmp_name']instead ofcopy.I want to copy the uploaded file into another dir they used function copy and not move_uploaded_fileso you want to do this the wrong way on purpose? Is this how you aim to learn PHP? Do you think this is a desirable skill for a programmer to have?