I'm a newbie.. er newby when it comes to php. sql etc.
I am presently using a oscommerce shopping cart. I loaded a contribution called customer add product. I loaded it up and everything seems to work fine. All except for the images will not upload. I've attemted to make little changes here and there and have been searching for answers as to why,
but nothing. The contribution does work for other people.. so I am so confussed at what to do right now. I don't know what is causing the problem or how to turn it around.
The images are suposed to load in a shop/images/thumb folder with permision set on 777 I have that and it still doesnt work.
Im wondering if I am missing something either in sql or my root folder which enables this. Am I suposed to have an upload_image.php like the one your describing here? I've completed a search in my folders and I don't seem to have one. atleast not by the same name. Could I load these files into the oscommerce cart? Would it make a differnce or crash it?
MY head is so fried Im not even sure what I should be asking.
Just any information about sql , php and image uploading might boot me in the proper direction.
This tutorial is for people that want to allow their visitors to upload image to their webite. If you are uploading images to your own site you should use an FTP client.
This tutorial is for people that want to allow their visitors to upload image to their webite. If you are uploading images to your own site you should use an FTP client.
Yup! thats exactly what I'm trying to enable. A mod/contribution that will allow customers to upload their own product images and descriptions.
I put your upload.zip in my site and after changing the persmissions it worked.
I gave a bad log in email in my last post. I've corrected it.
If you log into the account you will see "Add New Product"
This is where customers can add their own product images to the shopping cart. But I cant get the upload to work. Im not being shown an error other than "file does not exist" and Sql isnt really showing me any errors either. (only for an old cart)
But yours did work so that must mean that it can be done and its not some sql security issue getting in the way... Yes / no?
I just don't know where to look to make possible corrections.
Nan
PS. If my question/s are outside of what you would like discussed in this thread let me know and I can re ask it elsewhere. so it doesn't cunfuse people down the road or mess up a clean thread
Last edited by starynightskyz; 05-10-2006 at 02:48 PM.
Reason: Addon
i extended your fabulous script to an news upload script with optional image upload and a event script where one can upload a additional infosheet as pdf optionally.
the only drawback is that when there is an error (like file too big or no event title given) the form gets reloaded and the user has to type in all the details again from scratch..
is there a way to replace header("Refresh: 3; URL=\"$uploadForm\""); with a javascript go -1 since the browsers would then recall what was typed into the fields before?
is there a way to replace header("Refresh: 3; URL=\"$uploadForm\""); with a javascript go -1 since the browsers would then recall what was typed into the fields before?
Without starting a Javascript versus PHP debate, doing this with Javascript is a bad thing since there is no redundancy if Javascript is disabled. Also browsers don't necessarily record all the data in the input fields when using history. The method the demo uses was used in this instance to so each step of the proceedure was clear defined and understandable. The easiest way to deal with your problem is to rewrite the error handler so that instead of redirecting back to the upload form it instead reloads the form with the data preloaded. (PHP solution).
Hi,
Give the folder's permission 777 in FTP.
Or entering into the cpanel->Files->www->Upload Folder--> Change the permission as 777.
Then you can do it.
$file__name="john.doc";
move_uploaded_files($HTTP_POST_FILES(['file']['tmp_name']),'upoad_Files'.$filename);
Do it like this way.
Thanks both of you for your replies; however, I'm using dreamweaver MX to upload the files, and I cannot follow your steps. Would you please give me more details. Thanks.
You need to use your FTP client (the program you use to uploaded your scripts) to select the directory that recieves the files and change it to 0777 permission.
I ftp through the web address and allowd all persmissions for owner, groups, and users to he uploader folder; However, I'm still receiving the same error message. My guess is that I'm failing to giving permissions to the correct file/folder.
Should I modify any part of the script?
for example in the upload.processor.php file:
// fieldname used within the file <input> of the HTML form
$fieldname = 'file';
=> shouldn't instead of the name 'file', I have to create a folder to place the images that are going to be uploaded, and put the name there?
well sorry i didnt really answer that very well, its been a long day
If it were me and i havnt really looked at the code,
but here
PHP Code:
// now let's move the file to its final location and allocate the new filename to it
@move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename)
or error('receiving directory insuffiecient permission', $uploadForm);
// If you got this far, everything has worked and the file has been successfully saved.
// We are now going to redirect the client to a success page.
header('Location: ' . $uploadSuccess);
I would add a mySQL insert script
like this
PHP Code:
// now let's move the file to its final location and allocate the new filename to it
@move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename)
or error('receiving directory insuffiecient permission', $uploadForm);
//in addition to Bokeh's script you can insert each record into a database.
$q = "INSERT INTO table_name (`filename`,`date`) VALUES ('$uploadFilename',$date(dMy))";
$s = mysql_query($q);
//if an error
echo(mysql_error());
// If you got this far, everything has worked and the file has been successfully saved.
// We are now going to redirect the client to a success page.
header('Location: ' . $uploadSuccess);
and to display it would be a simple select script
I can't get this to work
I'm sure i'm just doing something wrong, but i've tried everything...
my script looks like this.
PHP Code:
// now let's move the file to its final and allocate it with the new filename
@move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename)
or error('receiving directory insuffiecient permission', $uploadForm);
//in addition to Bokeh's script you can insert each record into a database.
$conn = mysql_connect("localhost","Munkeyman","hgfjde34583")
or die("Could not connect to MySQL");
$db = mysql_select_db("images",$conn)
or die("Could not select database");
$q = "INSERT INTO uploaded_images (`filename`,`date`) VALUES ('$uploadFilename',$date(dMy))";
$s = mysql_query($q, $conn);
//if an error
echo(mysql_error());
// If you got this far, everything has worked and the file has been successfully saved.
// We are now going to redirect the client to the success page.
header('Location: ' . $uploadSuccess);
and i'm getting this error
Unknown column 'dMy' in 'field list'
Warning: Cannot add header information - headers already sent by (output started at c:\Apache\htdocs\Dinamic uni\uploader\new.upload.processor.php:69) in c:\Apache\htdocs\Dinamic uni\uploader\new.upload.processor.php on line 73
my database looks like this..
Code:
mysql> use images;
Database changed
mysql> show tables;
+------------------+
| Tables_in_images |
+------------------+
| uploaded_images |
+------------------+
1 row in set (0.00 sec)
mysql> explain uploaded_images;
+----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+-------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| filename | varchar(50) | YES | | NULL | |
| date | varchar(50) | YES | | NULL | |
+----------+-------------+------+-----+---------+-------+
3 rows in set (0.00 sec)
mysql>
If any one can help me it would be much appreciated!
Bookmarks