PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old June 10th, 2002, 12:23 PM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
I can't upload file from client

I can't upload file from client when run a uploadfile programming while can upload file from localhost.
The error return when run php script from clien:
Unable to open 'path_on_client:\filename_on_clien' for reading.No such file or directory in 'paht_on_server:\dirctory_on_server\...' on line ...

Please , help me . I thank very much



Reply With Quote
  #2  
Old June 10th, 2002, 12:49 PM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
RE: I can't upload file from client

Show us your script. but a script can't access 'path_on_client:\filename_on_client', else security would have some serious issues. The file needs to be sent to the server (ie. script), PHP will store the uploaded file to a temporary directory and then you need to copy it before the script ends..

Reply With Quote
  #3  
Old June 11th, 2002, 04:32 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: RE: I can't upload file from client


Quote:
my scripts:
//--begin upload.htm
<html>
<head>
</head>
<body>
<form action="uploadfile.php" method="post">
<input type=file name="userfile">
<input type=submit value=submit>
</form>
</body>
</html>
//--end upload.htm file


//--begin global.php file
function UploadFile($userfile,$pathonServer)
{
if(copy($userfile,$pathonServer))
{
echo ("File successfully copied!");
}
else
{
echo ("Error :Failed to copy file");
}
unlink($userfile);

}
//--end global.php file

//-begin upload.php file
<?
include("global.php");
// get the value of field named 'userfile'
from a html file .This value contain the path of userfile .

$pathuser=$_REQUEST['userfile'];

//get userfile's name from the path

$userfile1=split("\\",$pathuser);

//attach userfile into the path on server
$fileonserver="c:\temp\".$userfile1[count($userfile1)-1];

//call uploadfile function
uploadfile($pathuser,$fileonserver);
?>
//--end upload.php file

at client type:
http://serverhost:8080/upload.htm

then on screen appear follow:
Unable open .... for reading.....



Reply With Quote
  #4  
Old June 11th, 2002, 11:02 AM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
RE: I can't upload file from client

Modify your form tag to be :

<form action="uploadfile.php" method="post" method=multipart/form-data>

then in your code print_r($HTTP_POST_FILES) to have a lookie at the array it returns. You should be able to use move_uploaded_file($HTTP_POST_FILES["userfile"]["tmp_name"], $pathonServer)..

Reply With Quote
  #5  
Old June 14th, 2002, 05:09 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: I can't upload file from client

Your guides are very wonderful.I done successfully.Thank you very much and see you again .

Reply With Quote
  #6  
Old June 14th, 2002, 08:32 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: I can't upload file from client

Do you know scripts like "response.redirect" command in ASP?

Reply With Quote
  #7  
Old June 14th, 2002, 11:17 AM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
RE: I can't upload file from client

hmm, i usually use :

php Code:
Original - php Code
  1. <?
  2.   function redirect($url) {
  3.     header("Location: $url");
  4.     print("$url");
  5.     exit();
  6.   }
  7. ?>


I print the url coz some browsers seem to have a problem if they just get a redirect header and no actual output?

I think this is right.. it's just off the top of my head quick though..

Reply With Quote
  #8  
Old June 17th, 2002, 04:19 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: I can't upload file from client

How can I save a result set returned from a php into a html file ?

Reply With Quote
  #9  
Old June 17th, 2002, 02:02 PM
CmdrDats CmdrDats is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: <br><img src='http://www.dats.co.za/icon.gif'>
Posts: 269 CmdrDats User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to CmdrDats Send a message via AIM to CmdrDats Send a message via Yahoo to CmdrDats
RE: I can't upload file from client

Huh? what do you actually want to save to html?

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > I can't upload file from client


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway