Jump to content

Recommended Posts

Hi List,

 

Here is a php (windows server with IIS) newbie question.

I am trying to do the following:

I have php running on my windows (IIS) server and wrote some scripts to have a user “upload” a file (basically I only want to read a text containing addresses), and pass those addresses to my php scripts on the server that processes them (geocodes the address). All works fine when the address text file is located on the server itself.

It doesn’t work from a client machine though. When I open the URL and send the file name to php via html form like  “geo2.php?&filename=" + sendfilename”) and try to read that file. I am using fopen like this:

$fd = fopen ($filename, "r");

$contents = fread ($fd,filesize ($filename));

fclose ($fd);

PHP gets me this error using fopen:

 

Input file: file://F://web/read2/adress_only.csv

Warning: fopen(file://F://web/read2/adress_only.csv) [function.fopen]: failed to open stream: Permission denied in D:\web\sites\mapserver\geotool\geo2.php on line 13

 

I guess it’s a permission issue and searched the web …-  some people where saying that IIS can only access remote files on a windows box if they have a user account on the client machine (where the file text is located) – so that is not an option for me since its not and intranet application.

 

How would I go about reading the file on the client machine and getting that information to my php scripts on the server?

Use JavaScript to read the file and send via php post or get?

Upload the file to the server and then read it with php?

Which way should I go?

Thanks Karsten

 

Link to comment
https://forums.phpfreaks.com/topic/36851-reading-remote-file-on-client-machine/
Share on other sites

  • 6 months later...
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.