I want to get the absolute path I uploaded, but I only get the file name and template file! How can I obtain the absolute path of my upload.

Source: Internet
Author: User
I want to get the absolute path I uploaded, but I only get the file name and template file! How can I obtain the absolute path of my upload. Reply to discussion (solution)

What is the relationship with the absolute path on the uploaded machine?
You only need to process the file you received.

I don't know what you want to do with the path. if you really want to get it, try js.

What is the relationship with the absolute path on the uploaded machine?
You only need to process the file you received.

I want to obtain the absolute path and convert the format. sometimes someone else may upload an EXECL file. But Execl cannot be processed. I must convert it to CSV format before processing.

I don't know what you want to do with the path. if you really want to get it, try js.

Does PHP have any corresponding method to obtain it? it may not be long before PHP is converted. No relevant information is found online.

You are in Beijing, I am in shanghai. if I upload an excel file, do you want to convert it into a csv file on my machine?

After the file is uploaded, it is stored in the default temporary directory of the server by default, unless upload_tmp_dir in php. ini is set to another path. The default temporary directory of the server can be reset by changing the environmental variable TMPDIR of the PHP runtime environment.
If you can't find the directory, you can use move_uploaded_file to store it and then process it. In fact, you don't need to know the directory. you can simply store it and then process it.

You must use js to obtain the value of the input box and put it in the hidden domain, and then submit it together.

Don't make it complicated. you can prompt that you must upload a csv file.

You are in Beijing, I am in shanghai. if I upload an excel file, do you want to convert it into a csv file on my machine?

As you said, the switch must be completed on his side. But now I need not file, but data in the file. after direct local import, I save the data to the database.

You must use js to obtain the value of the input box and put it in the hidden domain, and then submit it together.

Don't make it complicated. you can prompt that you must upload a csv file.

What I did previously was that the manager had to change it to allow others to upload Execl directly. I think about how to implement it using JS.

Even if you get the local path of the file, can you use js to modify the local file?

After the file is uploaded, it is stored in the default temporary directory of the server by default, unless upload_tmp_dir in php. ini is set to another path. The default temporary directory of the server can be reset by changing the environmental variable TMPDIR of the PHP runtime environment.
If you can't find the directory, you can use move_uploaded_file to store it and then process it. In fact, you don't need to know the directory. you can simply store it and then process it.

This method (move_uploaded_file) is not available here. it seems to be a cache file generated by the server. if it is an upload Execl, it will be converted in advance, if it is switched. The data is incorrect. So after the upload is complete, click OK. first, convert the Execl file to the Csv format, and then use it directly without changing the program. I will try JS first. There are still many things to understand, but the principle you just mentioned. It is useful to me. thank you.

Even if you get the local path of the file, can you use js to modify the local file?

You can use PHP code to generate a new CSV file. I have tried this. yes.

Then you can determine the type of the uploaded file (the temporary file). If the judgment type is execl, use php to change it.

What are you doing ??? Upload a file to generate a temporary file name. this is the case. PHP has a function of the checking type. you have put it upside down.

The browser does not grant the webpage the permission to obtain local data. you can only upload the excel file directly to the temporary directory on the server, and then process the file on the server and import the file to the database after processing.
This is the only method.


After the file is uploaded, it is stored in the default temporary directory of the server by default, unless upload_tmp_dir in php. ini is set to another path. The default temporary directory of the server can be reset by changing the environmental variable TMPDIR of the PHP runtime environment.
If you can't find the directory, you can use move_uploaded_file to store it and then process it. In fact, you don't need to know the directory. you can simply store it and then process it.

This method (move_uploaded_file) is not available here. it seems to be a cache file generated by the server. if it is an upload Execl, it will be converted in advance, if it is switched. The data is incorrect. So after the upload is complete, click OK. first, convert the Execl file to the Csv format, and then use it directly without changing the program. I will try JS first. There are still many things to understand, but the principle you just mentioned. It is useful to me. thank you.


Didn't you upload a file? How can this function not be used? This function is dedicated for uploading and cannot be used elsewhere. You can move it to the target location where you can move it, and then you can handle it at will.


Even if you get the local path of the file, can you use js to modify the local file?

You can use PHP code to generate a new CSV file. I have tried this. yes.


Can you use js to modify files on users' computers ??? Miracle...

You want the user to input multiple data records and save them to the database.
If you can process the Excel file and obtain the Excel file uploaded by the user, extract the data from the Excel file directly through the background program and save it.
If you cannot process an Excel file, you should not upload it to another data format that you can process, such as directly entering a form or uploading a txt file in a fixed format.

As for getting the absolute path of the file uploaded by the user in the user's computer, you can't operate on the file on the user's computer even if it is obtained.



Even if you get the local path of the file, can you use js to modify the local file?

You can use PHP code to generate a new CSV file. I have tried this. yes.


Can you use js to modify files on users' computers ??? Miracle...

You want the user to input multiple data records and save them to the database.
If you can process the Excel file and obtain the Excel file uploaded by the user, extract the data from the Excel file directly through the background program and save it.
If you cannot process an Excel file, you should not upload it to another data format that you can process, such as directly entering a form or uploading a txt file in a fixed format.

As for getting the absolute path of the file uploaded by the user in the user's computer, you can't operate on the file on the user's computer even if it is obtained.


Upstairs positive solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.