Jump to content

Archived

This topic is now archived and is closed to further replies.

php_coder_dvo

PLS HELP. FOPEN function

Recommended Posts

can anyone help me, why i cannot open a file particularly CVS file.

here it goes, I create a scipt to open a csv file and import it to the database. Using the html input type="file" to brows a csv file. I tried it on the windows (winxp) the script works very fine, however when i upload it to my server which is linux. when i browse a csv file, i had an error

"[color=red]Warning: fopen(PARTNER_REPORT_USA_.CSV): failed to open stream: No such file or directory in /opt/lampp/htdocs/freshfire.ca/cms_admin/import.php on line 8

Warning: fgetcsv(): supplied argument is not a valid stream resource in /opt/lampp/htdocs/freshfire.ca/cms_admin/import.php on line 10[/color]"

and im stuck on this error. tnx guys for your help....

Share this post


Link to post
Share on other sites
Are you sure the file you entered in the fopen exists?

Orio.

Share this post


Link to post
Share on other sites
yes the file does exist, you see i created a script to browse file particularly csv, and when the user select a csv file on the windows platform, the script or the fopen function cannot read the file... my php script was on the linux server... cause i assume that the user wants to browse csv on the windows..

tnx for the reply, and help..

Share this post


Link to post
Share on other sites
So the file is in the same place as the script
and it is in CAPS
"PARTNER_REPORT_USA_.CSV"
And it has the _ after usa?

Share this post


Link to post
Share on other sites
the file is not on the same place, the php script was ont the linux, and that script can browse a csv file, assuming that the file was on the windows

Share this post


Link to post
Share on other sites
You mean the php file is not on the server which looks for a file on a remote PC. If thats the case then you cannot do that. As PHP runs on the server, it cannot interact with the client (remote PC). What your php script is doing is trying to find the csv file on the server and thus you are getting the returned error.

Share this post


Link to post
Share on other sites

×

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.