i need a php to upload an image

images php coding issues or problems here.

Moderators: macek, egami, gesf

friendly37
New php-forum User
New php-forum User
Posts: 8
Joined: Sat Jul 30, 2005 7:58 am
Location: usa
Contact:

i need a php to upload an image

Postby friendly37 » Sat Jul 30, 2005 8:01 am

hello every body

i need a simple php script to use it in my web site. i have a linux platform.

i have used one but it did not work.

i always get a message like an error in uploading the picture.

so help me please.

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Sat Jul 30, 2005 8:39 am

30$

friendly37
New php-forum User
New php-forum User
Posts: 8
Joined: Sat Jul 30, 2005 7:58 am
Location: usa
Contact:

I know where to buy things

Postby friendly37 » Sat Jul 30, 2005 9:31 am

:-x

hello

I don't want to buy anything. usually a forum is for help not for business.

thank you

User avatar
Oleg Butuzov
Last Samuray
Last Samuray
Posts: 831
Joined: Sun Jun 02, 2002 3:09 am

Postby Oleg Butuzov » Sat Jul 30, 2005 12:20 pm

so what help you need?

friendly37
New php-forum User
New php-forum User
Posts: 8
Joined: Sat Jul 30, 2005 7:58 am
Location: usa
Contact:

i need a form to upload pictures

Postby friendly37 » Sat Jul 30, 2005 2:58 pm

hello

I need a php or cgi scripts that upload a picture.

when my visitors come to my site, they leave me messages and their pictures. so I need a php script or a formmail that has this field to upload a picture.

someone gives me a php I install it by always my server gives me back a message telling me that there is an error.

i am just a beginner. even my hosting plan don't want to help me.

well my hosting plan has a linus platform.

i need someone who just tell me what to do with presicion.


thank you very much for your help.

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Sat Jul 30, 2005 3:27 pm

You can tell us what errors are you getting.
You can post your upload script as well.

User avatar
d.shankar
New php-forum User
New php-forum User
Posts: 71
Joined: Fri Jul 29, 2005 2:17 am

Postby d.shankar » Mon Aug 01, 2005 12:11 am

He is asking how to upload a picture to a database i think...

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Mon Aug 01, 2005 2:48 am

blahh: check out handling file transferes on php.net
To add it to the database you might just want to read the file content and post it to the DB.. how hard could that be? if something is unclear: ask, but tellWHAT exactly is unclear.

and dont get pissed if we are joking around sometimes :D Oleg is a bit sarcastic sometimes, I can be very mean if i get pissed and gesf.. gesf is just and angel... (You know, nice sweet guy with something heavy to smack those who do not follow the rules and double post) :) 8)

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Mon Aug 01, 2005 9:55 am

:oops:

friendly37
New php-forum User
New php-forum User
Posts: 8
Joined: Sat Jul 30, 2005 7:58 am
Location: usa
Contact:

check this and try to fix it please

Postby friendly37 » Mon Aug 01, 2005 3:47 pm

hello

i know there is a mistake but i can not locate it.

well I will tell you what I did in details.
1. i have an html file and put these codes:

Code: Select all

<form enctype="multipart/form-data" action="uploader.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="100000" />
Choose a file to upload: <input name="uploadedfile" type="file" /><br />
<input type="submit" value="Upload File" />
</form>
2. then I made a foler named uploads
3. then I made a php file named as uploader.php it contains these codes:

Code: Select all

<?
$target_path = "uploads/";

$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_F ILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}

?>
4. i put this file in the root but it did not work then i put the php file in the forder uploads but it did not work.
5. i have changed mchmod to 777 it did not work then to 775 it did not work.

Now please tell me what to do.

please even if you have a cgi picture upload send it to me.

for me i want just to collect information with pictures from my visitors.

i asked my hosting plan technician he told me that the formmail I used has not this field of picture upload.

so what to do now?

thank you for your patience and help

** Edited by gesf

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Mon Aug 01, 2005 4:20 pm

Please use code tags next time.

Try first printing your $target_path variable to see if it's ok.
Also use error_reporting(E_ALL) at first in your code to check if no errors are making some functions not working properly.

friendly37
New php-forum User
New php-forum User
Posts: 8
Joined: Sat Jul 30, 2005 7:58 am
Location: usa
Contact:

I don't know anything

Postby friendly37 » Mon Aug 01, 2005 5:35 pm

please i don't know anything in php codes

try just to copy the codes and fix the problem.

i don't know what do you mean by printing.

if you can.

because i have followed all the moderators say but still I don't know what is issing.

if it is impossible .

i know that there is a simple and easy mistake in my codes but I don't know how to fix it.

if there is an alternative to upload a picture like a formmail script please send me one.

for me i have a lot of visitors who come to my site I just want to upload their information and pictures.
thank you

User avatar
gesf
Moderator
Moderator
Posts: 1717
Joined: Sun Dec 29, 2002 5:03 am
Location: Portugal / Sweden
Contact:

Postby gesf » Mon Aug 01, 2005 6:17 pm

Ok :)
Printing i mean print, same as echo.

Code: Select all

<?php

error_reporting(E_ALL);

$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

if(move_uploaded_file($_F ILES['uploadedfile']['tmp_name'], $target_path)) {
     echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else{
     echo "There was an error uploading the file, please try again!";
}

echo $target_path;

?>
Give it a try! Check for given errors and for the value of your $target_path.

friendly37
New php-forum User
New php-forum User
Posts: 8
Joined: Sat Jul 30, 2005 7:58 am
Location: usa
Contact:

error

Postby friendly37 » Tue Aug 02, 2005 1:24 pm

hi

i have you used your php script and get this reply

Parse error: parse error, unexpected T_STRING in /home/wheredat/public_html/uploader.php on line 1


someone who has given me this scripot asks me to chage the chmod to 777. i did it but in vain.

well please I amusing a linux platform. you know i have no idea what is the difference between linus or windows platforms.

if you can check again I will be grateful.

please if you know a formmail that do the job and upload a picture send it to me. thank you

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

Re: error

Postby ruturajv » Thu Aug 04, 2005 8:44 pm

friendly37 wrote:hi

i have you used your php script and get this reply

Parse error: parse error, unexpected T_STRING in /home/wheredat/public_html/uploader.php on line 1


someone who has given me this scripot asks me to chage the chmod to 777. i did it but in vain.

well please I amusing a linux platform. you know i have no idea what is the difference between linus or windows platforms.

if you can check again I will be grateful.

please if you know a formmail that do the job and upload a picture send it to me. thank you


buddy you have a parse error, forget everything else, please check your script for parse or syntax errors!

friendly37
New php-forum User
New php-forum User
Posts: 8
Joined: Sat Jul 30, 2005 7:58 am
Location: usa
Contact:

lol I don't know

Postby friendly37 » Fri Aug 05, 2005 2:21 pm

hello


I am here because I don't know any thing about php.

I am asking for a professional who knows how to fix this up.

this php script has been given by a moderator in another forum. but he could not know the problem. that is why I have changed the forum.

i am very frustrated that so many professionals don't know how to fix a simple script.

thank you

User avatar
Alexej Kubarev
Site Admin
Site Admin
Posts: 2223
Joined: Fri Mar 05, 2004 7:15 am
Location: Täby, Stockholms län
Contact:

Postby Alexej Kubarev » Fri Aug 05, 2005 2:41 pm

its because you are baing unclear.
Do you want to uplod the file to some place or save it to the database?

give everything in DETAILS so that we can help you. The answer you get depends on the questions you ask and the way you ask and explain what you need.
Note that we prefere making people LEARN what to do with our help and not make the whole job for them.

In case you wish someone to do the job FOR you: post a request in the PHP Jobs section and you might get lucky and someone will do it.. however in most cases people dont like charity and work for free

friendly37
New php-forum User
New php-forum User
Posts: 8
Joined: Sat Jul 30, 2005 7:58 am
Location: usa
Contact:

yes I want to learn

Postby friendly37 » Fri Aug 05, 2005 4:02 pm

hello Alexei Kubarev


well yes i want to learn php

lkisten I have stated my problem. i have a site and i want my visitors fill a form having php script to upload their pictures to my site.
.
.i have a linux platform.

a moderator gives me a php script but it did not work. i don't know why?

well I don't need charity. be polite.

here it is a forum if you don't know how to fix the problem just don't answer me you are not obliged to do so.

i will find other moderators who have patience.
thank you

php-vikas
New php-forum User
New php-forum User
Posts: 164
Joined: Mon Apr 14, 2003 12:25 am
Location: India
Contact:

Postby php-vikas » Fri Aug 05, 2005 10:02 pm

Will you please send me all the code on the following email address.

vikas@enablingbiz.com or rv1605@yahoo.com

Also please let me know the website address, where you had uploaded this script?

I assure you that i will definitely sort out your problem.

Also please don’t blame the professional who are giving their valuable time to solve out your problem. It shows your impatience too!

Regards,
Vikas Garg
enablingbiz Esolution
http://www.enablingbiz.com
9891459084


Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 1 guest