dexter_sherban Posted April 5, 2007 Share Posted April 5, 2007 Hi Im writing a php file that will upload pictures in a remote directory. Im actualy doing a buletin board,and i have a mysql table that has subjext message date and entries(key) columns. I want the user to be able to aslo upload a image when posting a message. So I figured the best way to do this is to upload all files in a dirr and add the column 'image filename' to the mysql table for each entry. Im not sure how to read the file names for each entry. My guess was to use $image = basename($path); but how will it know to store differet file names for each entry in the table. Does anyone know ? Link to comment https://forums.phpfreaks.com/topic/45735-reading-file-names/ Share on other sites More sharing options...
dexter_sherban Posted April 5, 2007 Author Share Posted April 5, 2007 I'd just like to make an update . I got premission, and uploading files works. and I made the upload file function which is this function Upload_Picture($entry) { move_uploaded_file($_FILES["picture"]["tmp_name"], "uploads/" . $_FILES["picture"]["name"]); // Uploading works. I tried using the following line of code to assign a varriable for the image $image=$_FILES["picture"]["name"]; // And it works. I get the filename when I print the variable echo "$image"; //Now when I check the table in mysql instead of seeing the filename in the image column I see an empty column. To note that the column IS NOT NULL. And all entries prior to this had image column NULL. I tried making the column both Varchar(20) and BLOB. mysql_query("update message set image='$image' where entry=$entry"); } So I kinda restate my question. Why is the update for the entry empty ? Link to comment https://forums.phpfreaks.com/topic/45735-reading-file-names/#findComment-222200 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.