Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Upload Image to Folder and Form Texts Inputs to MySQL

Guest
Aug 25, 2011 Aug 25, 2011

Copy link to clipboard

Copied

Hi All,

I am developing a form for storing events and venues, two different forms with the events taking all it's venue details from the venue database.  For the venue database I want to store in the MySQL database the name, address and contact details of the venue but I also want the html form to upload an image to the server with the details of the image stored in the database.

I have created the databased and the forms but am having trouble with the php code to upload the image to a folder on the server while storing the rest of the details in the database.

Please could someone suggest a solution, a link to a tutorial etc?

Thanks in anticipation,

Lloyd.

TOPICS
Server side applications

Views

863
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 25, 2011 Aug 25, 2011

Copy link to clipboard

Copied

First, you need to use a File Field for your image file. This is just a text field that includes the browse button for the user to select the image. It will be available to your inser record behavior the same as a text field. By default, it will enter the image filename to your database. If you want to store the full path to the image as it will be on the server, you have to edit the code accordingly. As an alternative, you can leave it as is, and add the oath later when you go to retrieve the image for display. The second part is the upload script, of which there are many. I'm sorry I can't point you to one in particular other than what I use - Digital File Pro extension from Web Assist. This is a pay for product, and ther are others. But I'm sure you can find some other free extensions or scripts that will work. A search for PHP file upload here or Google should present plenty of options.  I would suggest to test the upload script independently of the insert before merging both functions.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 25, 2011 Aug 25, 2011

Copy link to clipboard

Copied

Thanks Lon Winters,

I had already had the form complete with the type=file already added.  It was just what happens after the submit

I think I will go for the extension option from WA. Never thought to look there, probably time to upgrade to one of their bundles.

Regards,

Lloyd

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Aug 26, 2011 Aug 26, 2011

Copy link to clipboard

Copied

LATEST

You can also look at DMXZone, they offer many similar products as Web Assist. With WA, Digital File Pro is now bundles with Universal Email, which is also part of my development toolkit that I use all the time. DFP also offers a progress bar indicator the displays while the file is being uploaded. You should have no trouble adding that to the page with your form and insert record behavior. One thing to be forewarned of, and this applies to a slightly different variation of what you're doing now. I had a form that instead of doing a database insert, I used Universal Email to send an email. The form did have a file field that would select a file and add it to the email as an attachment. I could have added an insert record if needed without any problem. But what I did need to do was upload the file to a folder as well as include it as an attachment. This did not work simply by applying both the extensions, it involved some tweaking within the extension dialogs. So if you do end up getting the extension and find yourself in the same situation, feel free to PM me if you need to.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines