file uploads

This is a discussion on "file uploads" within the PHP Forum section. This forum, and the thread "file uploads are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Mar 23rd, 2008, 22:43
Junior Member
Join Date: Feb 2008
Location: U.S.A
Age: 26
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
file uploads

hey guys, i have a webhosting account with webhostingbuzz.com, and i am trying to do a simple script where you upload a jpeg. when i tried it out, the site gave me this error:
Warning: move_uploaded_file([where i want it to go])[function.move-uploaded-file]:failed to open stream:HTTP wrapper does not support writeable connections in [my source file] on line 13.

here is my code:
if (move_uploaded_file($_FILES['file']['tmp_name'], $target_path)) {...
thats all thats really relevant- thats line 13. anybody know how to fix? thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Mar 23rd, 2008, 22:52
Junior Member
Join Date: Oct 2007
Location: Sweden
Age: 29
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Re: file uploads

I haded this error once. I think that it should be something wrong with your target path ($target_path) you have to use local path....
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Mar 23rd, 2008, 23:10
Junior Member
Join Date: Feb 2008
Location: U.S.A
Age: 26
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Re: file uploads

$target_path is a variable i made- its contents is http://www.domainname.com/pics/[$_FILE['file']['name'] goes here]
i have to do something about "localpath" you say? thx
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Mar 24th, 2008, 06:30
Reputable Member
Join Date: Nov 2007
Location: India
Posts: 150
Blog Entries: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Re: file uploads

Are the permissions to your upload directory set to 777 ?
And btw are you trying to upload files to a server other than your own?
Last Blog Entry: Cross browser nuisance (Feb 11th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Mar 24th, 2008, 10:15
Junior Member
Join Date: Feb 2008
Location: U.S.A
Age: 26
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Re: file uploads

no, this is all on my own server. i will check wether it is set to "777"- thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old Mar 24th, 2008, 10:20
Jack Franklin's Avatar
Moderator

SuperMember
Join Date: May 2007
Location: Cornwall, England
Posts: 1,405
Blog Entries: 8
Thanks: 18
Thanked 14 Times in 14 Posts
Re: file uploads

Can we see the entire script please?
__________________
Jack Franklin - Webforumz Moderator
(x)HTML | CSS | PHP | MySQL | JQuery (Javascript)
Contact: My Blog | Twitter | Delicious
Want Lessons? PM me.
If you think I've helped, please press the 'Thanks' Button.
Last Blog Entry: A Week with VBulletin (Aug 28th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7  
Old Mar 24th, 2008, 18:02
Junior Member
Join Date: Feb 2008
Location: U.S.A
Age: 26
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Re: file uploads

wait- so do i want it to be 777, because it was 755.. ichanged it to test it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8  
Old Mar 24th, 2008, 18:18
Junior Member
Join Date: Feb 2008
Location: U.S.A
Age: 26
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Re: file uploads

okay, that ended up getting me nowhere. here is the code for the html form where they choose the file:

<form enctype="multipart/form-data" action="mainpicsrcupdate.php" method="post">
<table align="center" bgcolor="green" cellpadding="5" cellspacing="4">
<tr><td>[FILEPATH:]</td><td><input type="file" name="mainpicsrc" id="mainpicsrc"></td></tr>
<tr><td colspan="2"><input type="submit" value="[UPDATE]"></td></tr>
</table>

then here is the mainpicsrcupdate.php relevant part:

$target_path = "http://www.domainname.com/mainpics/";
$target_path = $target_path . basename($_FILES['mainpicsrc']['name']);
if ($_FILES['mainpicsrc']['type'] == "image/pjpeg") {
if (move_uploaded_file($_FILES['mainpicsrc']['tmp_name'], $target_path)) {?>
<h1 align="center">[UPLOAD SUCCESSFULL]</h1>
<?PHP }
else { ?>
error occurred
<?PHP
} ?>

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9  
Old Mar 24th, 2008, 19:19
Junior Member
Join Date: Oct 2007
Location: Sweden
Age: 29
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Re: file uploads

have you tried to change the $target_path :
from
Code: Select all
$target_path = "http://www.domainname.com/mainpics/";
to
Code: Select all
 $target_path = "mainpics/";
it depends where you have your script ex:
if is situated in
http://www.domainname.com/admin/;
$target_path should be :
Code: Select all
  $target_path = "../mainpics/";
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10  
Old Mar 24th, 2008, 19:40
Junior Member
Join Date: Feb 2008
Location: U.S.A
Age: 26
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Re: file uploads

it worked! hardcore. thanks guys, really needed it
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Uploads Images! Need help randy9378 Web Page Design 2 Oct 23rd, 2007 19:05
Multiple file uploads robukni PHP Forum 12 Sep 6th, 2007 12:49
Video Uploads Accurax Webforumz Cafe 32 Mar 19th, 2007 13:11
Allowing Customer Uploads? Help! gingermop Hosting & Domains 3 May 10th, 2006 11:09


All times are GMT. The time now is 16:15.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42