Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Pro PHP
|
Pro PHP Advanced PHP coding discussions. Beginning-level questions will be redirected to the Beginning PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 1st, 2006, 02:15 AM
Authorized User
 
Join Date: Jan 2006
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default image file copying!

Warning: copy(c:\inetpub\wwwroot\aaa\imgaes\44.jpg): failed to open stream: No such file or directory in c:\inetpub\wwwroot\aaa\thanks.php on line 45
Ur file could not copied

I am getting this error while executing this lines of code:
if(isset($_REQUEST['picfile']))
 {
    $img_name=$_REQUEST['studentid'].".jpg";
   $destination="c:\\inetpub\wwwroot\\aaa\\imgaes\\". $img_name;
   if(copy($_REQUEST['picfile'],$destination))
    {
     print "Ur file has been copied";
    }
    else
     {
      print "Ur file could not copied";
     }
 unlink($_REQUEST['picfile']);
}
I will b very thankful to you for removin this error, Thank you.

 
Old February 12th, 2006, 06:15 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That looks plain weird..
$destination="c:\\inetpub\wwwroot\\aaa\\imgaes\\". $img_name;
Thats wrong . should be something like
$destination="/aaa/images/".$img_name;
Don't use the full path it just create problem

Thats the code I use to upload pictures:
$upload=0;
$noupload="";
$maxfilesize=100000;

if ($_FILES['pix']['size'] <= $maxfilesize) {

    if ($_FILES['pix']['tmp_name'] == "") { $noupload="The file did not upload."; }


    if ($_FILES['pix']['type'] == "image/gif")
    {
@$destination = 'Pictures_Members/'.$_SESSION['username1'].".gif";
@$temp_file = $_FILES['pix']['tmp_name'];
move_uploaded_file($temp_file,$destination);
$upload=1;
$noupload="";
    }

Hope that help.
 
Old March 22nd, 2006, 06:19 AM
Registered User
 
Join Date: Mar 2006
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try using
copy($_FILES['picfile']['tmp_name'],$destination

In place of
copy($_REQUEST['picfile'],$destination






Similar Threads
Thread Thread Starter Forum Replies Last Post
Help in copying some row and coloums to a file RAMBO29 Excel VBA 2 March 15th, 2007 03:05 AM
Copying and connecting to a file metal2000man BOOK: Professional SQL Server 2005 Integration Services ISBN: 0-7645-8435-9 0 May 31st, 2006 12:35 PM
copying file from one machine to other CsharpHelp C# 0 October 23rd, 2005 05:22 AM
copying the file from one machine to other CsharpHelp C# 0 October 23rd, 2005 05:20 AM
Copying a File, How? xgbnow Visual C++ 3 September 16th, 2003 03:37 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.