Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
php file uploading problem ..???
Old 11-11-2009, 08:22 AM php file uploading problem ..???
Junior Talker

Posts: 1
Name: Thushara
Trades: 0
I have tried to upload a file using php. The code was
-uploadfile.php-

<?php
if(isset($_POST['upload'])){
include("form_upload.inc");
}
else{
if($_FILES['pix']['temp_name']=="none"){
echo "Files didn't successfully uploaded.
";
include("form_upload.inc");
exit();
}
if(!ereg("image",$_FILES[
'pix']['type'])){
echo "File is not a picture
";
include("form_upload.inc");
exit();
}
else{
$destination="F:/Installed\/Xampp/xampp/htdocs/test/upload".$_FILES['pix']['name'];
$temp_file=$_FILES['pix']['name'];
move_uploaded_files($temp_file,$destination);
echo "<p> file uploaded successfully
{$_FILES['pix']['name']}
({$_FILES['pix']['size']})</p>";
}
}

?>

And I create an interface in an include file call 'form_upload.inc'

<html>
<head><title>File Upload</title></head>
<body>
<p>Enter the name of the picture</p>
<div align="center"><form enctype="multypart/form-data"
action="uploadFile.php method=POST">
<input type="hidden" name="MAX_FILE_SIZE" value="500000">
<input type="file" name="pix" size="60">
<p><input type="submit" name="Upload"
value="Upload Picture">
</form>
</body>
</html>

interface is working but uploaded image is not at the particular destination, "F:/Installed\/Xampp/xampp/htdocs/test/upload".
I have set "upload_tmp_dir=" in php.ini to the destination address.

but when I upload "object not found" error occurred...

PLEASE HELP ME ......!!!!!!!!!!
ED!T is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 11-11-2009, 08:34 AM Re: php file uploading problem ..???
tripy's Avatar
Do not try this at home!

Posts: 3,621
Name: Thierry
Location: I'm the uber Spaminator !
Trades: 0
to help you, we need the whole page code, and the exact error message, with the line number.
__________________
Only a biker knows why a dog sticks his head out the window.
tripy is offline
Reply With Quote
View Public Profile Visit tripy's homepage!
 
Old 11-11-2009, 01:06 PM Re: php file uploading problem ..???
prasanthmj's Avatar
Experienced Talker

Posts: 42
Name: Prasanth
Trades: 0
It should be "multipart/form-data"
$temp_file=$_FILES['pix']['name'];
should be
$temp_file=$_FILES['pix']['tmp_name'];

and I guess the first if should be:
if(!isset($_POST['upload'])){
include("form_upload.inc");
}

The page below might help:
Email form with file attachment in PHP
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
prasanthmj is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to php file uploading problem ..???
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11867 seconds with 12 queries