Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning 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 September 26th, 2009, 02:00 AM
Registered User
 
Join Date: Sep 2009
Posts: 6
Thanks: 1
Thanked 1 Time in 1 Post
Question problem about not getting the uploadfile address...

This is my code where i am uploading the file and trying to copying it into another direcotry. But i am facing a problem. The problem is that my uploaded file address is lost when i am checking for copying.. Also i need help about "how do i get the name,size and type of the uploading file? Help me please..............

************************************************** **************

<html>
<head>
<title>A file upload script</title>
</head>
<?php
$file_dir = "c:/wamp/tmp"; // this is new copy address.
$fupload = $_POST['fupload'];
echo "<br> printing the upload directory address: $fupload";
if ( isset( $fupload ) )
{
print "path: $fupload<br>\n";
print "name: $fupload_name<br>\n";
print "size: $fupload_size bytes<br>\n";
print "type: $fupload_type<p>\n\n";
if ( $fupload_type == "image/gif" )
{
copy ( $fupload, "$file_dir/$fupload_name") or die ("Couldn't copy");

print "<img src=\"$file_dir/$fupload_name\"><p>\n\n";
}
}
?>
<body>
<form enctype="multipart/form-data" action="<?php print $PHP_SELF?>" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="51200">
<input type="file" name="fupload"><br>
<input type="submit" value="Send file!">
</form>
</body>
</html>

************************************************** ***************
 
Old December 13th, 2009, 10:18 PM
Authorized User
 
Join Date: Dec 2008
Posts: 50
Thanks: 1
Thanked 5 Times in 5 Posts
Default

try following

PHP Code:
<html> 
<head> 
<title>A file upload script</title> 
</head> 
<?php 
print_r
($_FILES);
?> 
<body> 
<form enctype="multipart/form-data" action="<?php print $PHP_SELF?>" method="POST"> 
<input type="hidden" name="MAX_FILE_SIZE" value="51200"> 
<input type="file" name="fupload"><br> 
<input type="submit" value="Send file!"> 
</form> 
</body> 
</html>
read more here http://php.net/manual/en/reserved.variables.files.php





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with blank fields in Shipping Address radrussell BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 November 23rd, 2009 11:57 AM
array address problem chris1012 Java Basics 3 December 18th, 2007 11:46 AM
UpLoadFile leily Pro JSP 1 May 2nd, 2006 11:09 PM
UploadFile Problem tony_j_hug ASP.NET 2.0 Basics 0 November 8th, 2005 06:34 AM
Retreiving IP address & gateway address sjangit VBScript 0 February 3rd, 2004 02:02 PM





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