Because to do a project just contact PHP, now encountered a problem, want to upload the file to operate, such as slicing, should I first upload the file to operate or should first slice and then upload? PHP does not seem to get the absolute path to the file
Reply to discussion (solution)
PHP can not access the client's files, of course, first upload and then process
First upload in the processing, how does PHP handle the uploaded files?
PHP can not access the client's files, of course, first upload and then process
First upload in the processing, how does PHP handle the uploaded files?
Learning is necessary http://www.w3school.com.cn/php/php_file_upload.asp
PHP can not access the client's files, of course, first upload and then process
I mean not to say how to upload files, is the file has been uploaded, how to operate the server-side files
You didn't say what to do, how do I know how you're going to operate it?
You didn't say what to do, how do I know how you're going to operate it?
For example, I want to do file segmentation, according to what you said before using the form upload, php how to this uploaded file to be sliced?
$filename = ' You are ready to slice the file name '; $cutsize = 1024; The size of each file after slicing $size = File_size ($filename); $fp = fopen ($filename, ' RB '); $i = 0;do { $buf = fread ($fp, $size); File_put_contents (Str_replace ('. '). "_$i.", $filename), $buf); $i + +;} while (strlen ($buf) = = $size); fclose ($FP);
$filename = ' You are ready to slice the file name '; $cutsize = 1024; The size of each file after slicing $size = File_size ($filename); $fp = fopen ($filename, ' RB '); $i = 0;do { $buf = fread ($fp, $size); File_put_contents (Str_replace ('. '). "_$i.", $filename), $buf); $i + +;} while (strlen ($buf) = = $size); fclose ($FP);
Moderator, I also made this.
File upload and file segmentation the two parts of the code I've made.
But what about the segmentation after file upload?
I uploaded the file and found that I couldn't get the absolute path of the file, so I can't slice it.
How did you receive the upload?
How did you receive the upload?
My upload is the user in the form browse box to select files. But the input here shows that the file name is not an absolute path, and my file segmentation is only for local files, that is, the file name specified in the code (absolute path)
What does $_files do?
All the information for uploading the file is inside it.
What does $_files do?
All the information for uploading the file is inside it.
$_files[' myFile ' [' name '] Displays the original name of the client file and does not get an absolute path.
Is it possible to slice a file after it has been uploaded? Does the file operation after uploading be done by PHP?
$_files[' myFile ' [' Tmp_name '] is the file name after uploading
$_files[' myFile ' [' Tmp_name '] is the file name after uploading
So after uploading to $_files[' myFile ' [' tmp_name '] to operate it? Is the segmented file placed on the server?
On the server, of course, can you write to the user's machine?
On the server, of course, can you write to the user's machine?
I i I, thank you moderator!! I will continue to study hard!!
Haha, the moderator to ask the urgent
Just try it and see what the tutorial is all about.
Haha, the moderator to ask the urgent
Just try it and see what the tutorial is all about.
I just learned a long time, the moderator is too patient, haha, a good life peace