TechThat Posted February 29, 2012 Share Posted February 29, 2012 Hello freaks! Im new to this forum, but im not all that new to PHP and MySQL. Although there's been some years since the last time I used it, so don't go all freaky on me if I dont do this right Let's go on-topic: Im in progress of making an internal web-page for me and my colleagues to make things a bit easier for us. I am making an database of our different projects, and I need some help with the input form - as I need to upload an image to the server, and store the path in the MySQL database. In my input form, I need to store information from text fields, and I need to upload an image to the server and store the path in the database. Before I can even start to code this (although I have coded the input forum without the upload), I need to know what would be the best way to do this. I guess there are several ways.. What would the expert do (That's you right?)? Should I have the information input, and image upload in the same form, or should I make a second form (maybe on a different page) for the upload? Is it necessary with two tables, one for the info and one for the image path, and then tie them together with the imageID, or is it fine to use just one table? Any thoughts would be appreciated! <!-- TechThat --> Quote Link to comment https://forums.phpfreaks.com/topic/257991-upload-image-and-add-path-to-mysql-database/ Share on other sites More sharing options...
bspace Posted March 1, 2012 Share Posted March 1, 2012 well i for one wouldn't bother reinventing the wheel have a look at http://www.uploadify.com/ and http://www.verot.net/php_class_upload.htm uploadify is jquery it needs a 'script' to do the actual uploading, i use a file i call upload.php this uses the php_class_upload class to do the work, at the end of this, if the upload succeeds i put the mysql update bit so, i use the jquery / uploadify bit on my main entry page this calls upload.php to do the lifting if the upload succeeds the database is updated with the file name uploadify can then, via a javascript callback, refresh part of your page with the newly uploaded image this lot takes a little understanding of using jquery/javascript and php together but you end up with a nice reactive file upload oh, and i'd use two tables as you suggest if in the future your going to need two or more images for the info, your good to go Quote Link to comment https://forums.phpfreaks.com/topic/257991-upload-image-and-add-path-to-mysql-database/#findComment-1322538 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.