473,668 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

problem with upload..

11 New Member
i got html code
file name
[HTML]html
<html>

<head>
<title></title>
</head>

<body>
<form enctype="multip art/form-data" action="upload. php" method="POST">
Please choose a file: <input name="uploaded" type="file" /><br />
<input type="submit" value="Upload" />
</form>
</body>

</html>
[/HTML]
and my php file name upload.php
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. $target = "http://example.com/up/";
  4. $target = $target . basename( $_FILES['uploaded']['name']) ;
  5. $ok=1;
  6.  
  7. //This is our size condition
  8. if ($uploaded_size > 350000)
  9. {
  10. echo "Your file is too large.<br>";
  11. $ok=0;
  12. }
  13.  
  14. //This is our limit file type condition
  15. if ($uploaded_type =="text/php")
  16. {
  17. echo "No PHP files<br>";
  18. $ok=0;
  19. }
  20.  
  21. //Here we check that $ok was not set to 0 by an error
  22. if ($ok==0)
  23. {
  24. Echo "Sorry your file was not uploaded";
  25. }
  26.  
  27. //If everything is ok we try to upload it
  28. else
  29. {
  30. if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
  31. {
  32. echo "The file ".
  33. basename( $_FILES['uploadedfile']['name']). " has been uploaded";
  34. }
  35. else
  36. {
  37. echo "Sorry, there was a problem uploading your file.";
  38. }
  39. }
  40. ?>
  41.  
  42.  
<link removed> is place where i want to upload file
<link removed> is place where my script is located
and when run the script i am reciving thiss

Expand|Select|Wrap|Line Numbers
  1. Warning: move_uploaded_file(http://example.com/up/l1.php) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections. in /is/htdocs/wp1055726_DP59DMU8M7/www/upload.php on line 37
  2.  
  3. Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpAKTFWT' to 'http://example.com/up/l1.php' in /is/htdocs/wp1055726_DP59DMU8M7/www/upload.php on line 37
  4. Sorry, there was a problem uploading your file.?> 
  5.  
please help
Oct 19 '07 #1
3 3999
Atli
5,058 Recognized Expert Expert
Hi.

I have removed the links from your post. Please refrain from using real URL's in your posts.

As to your problem.
Try using a relative path to the your $target file instead of an absolute path.
Instead of using "http://example.com/up/" use "up/".
Oct 20 '07 #2
kujtim
11 New Member
thenks for your advise about url's .

i have tryed to to use the relativ url but steal not working . i am reciving the same warning as before

Expand|Select|Wrap|Line Numbers
  1.  Warning: move_uploaded_file(New Text Document.txt) [function.move-uploaded-file]: failed to open stream: Permission denied in /is/htdocs/wp1055726_DP59DMU8M7/www/upload.php on line 37
  2.  
  3. Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpvbACgU' to 'New Text Document.txt' in /is/htdocs/wp1055726_DP59DMU8M7/www/upload.php on line 37
  4. Sorry, there was a problem uploading your file.?>
  5.  
thenks for helping
Oct 20 '07 #3
Atli
5,058 Recognized Expert Expert
Hi. Sorry for the late reply.

Take a closer look at the second batch of errors. That is not the same error as before :)

This error would suggest that you (the user that is running your http server) does not have permission to write in the directory you are trying to save the files in.

The PHP code works fine (most likely). The problem is that you server won't allow it to write into that particular directory.

The best way to make sure your PHP code can write to a directory is that have a PHP code create it. Check out the mkdir() function.
Oct 23 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2372
by: Paul Hamlington | last post by:
Hello, I've been programming in ASP for a little while now and quite an advanced user, but I have come across an unusual problem in which I need assistance. I have built my own image upload, I have two versions of the binary to string conversion one fast, one slow because some servers use chillisoft and therefore the append function in not accessible for a disconnected recordset.
3
3270
by: John Rebbeck | last post by:
(sorry about cross posting but I really need help with this and it fits in both newsgroups) I'm creating a little image manager and I'm using Persits ASPUpload. I have an UploadButton and DeleteButton which are both submits. Normally I would do: code:----------------------------------------------------------------------- -------
4
2416
by: NohaKhalifa | last post by:
Dear All; I'm developing a web site and i need to make adminisration for this site it's a site for Real Estates . But I don't need the administration to be online .. I want them to fill data and images offline and then send them online... but i have a problem regarding the images i want it to be sent to the web site So i want if there is a possible way to fill data offline and
3
2572
by: Tim::.. | last post by:
Can someone please tell my why I get the following problem when I type the following piece of code! How do I get around this??? The idea is that when a user clicks a button on a form it causes a postback to occur which in turn triggers a sub in a user control... Error: Argument not specified for parameter e of Public Sub UploadDate(Sender As
2
5950
by: prakharv | last post by:
Hi All, Below is the code which I am using to upload a jpeg file to the server. But the problem I am facing is that it is not copying the entire contents of the image file to the webserver and it doesn't works on IE. Please, help me out as I am new to this and would be highly thankful if anyone has running code for uploading image files to the server using CGI either Perl or C. This code i took it from net only. #!/usr/bin/perl -w
0
1129
by: RichBurdes | last post by:
Hi All, I've just started using ASPupload and can successfully submit files to a directory on the web server and form data to a database - i can then retrieve the form data and links to the files through an "edit" page to allow a user to adjust their content and resubmit the form and files, either as a draft (which just saves things) or as a real submission (which saves and emails their manager with links back to the content). The problem...
4
1788
by: Muddasir | last post by:
Hi.. i am having a strange problem.......the problem is i am trying to upload a file and to store it in db....when the file got stored in db...it got converted into black and white image and the stored in db with the same name("b"appended in the begining of the filename). now the problem is that...the following script only converts three images which i was using through out the testing phase......now it uploads only those three images...
12
3371
by: K. | last post by:
Hello! I have a problem with SWFupload class1. I have the page with uses SWFUpload class. Everything worked fine until (I suppose my admin) implemented some changes into the server. Now uploading file doesn`t work 2. I select one small file which is uploading 3. I get the status "Complete", but file is not being uploaded, because it doesn`t exist on my server. On the beginning of the upload.php file I`ve added easy insert query into the...
2
1616
by: swethak | last post by:
Hi, i wrote a code to upload a image.In my local it works fine. When i place this code in website through FTP. In that it will not works. i am giving the upload path ../upload . When i try to give the chmod permissions in FTP through fileattributes propery to upload folder it will give the message as Status: Set permissions of '/admin/upload' to '777' Command: SITE CHMOD 777 upload Response: 500 'SITE CHMOD 777 upload': command not...
0
8459
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8367
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8889
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8570
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8650
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.