Jump to content

File Uploading Help.


Jabop

Recommended Posts

I have a small form that submits a form named 'article' into a database. There is a checkbox on the form that, if checked, will redirect to an upload page.

 

I have a table in my database for the article, and a separate database for the uploaded images.

 

Article Table:

ID | Article Name | Article Body

 

Image Table:

ID | ArticleID | ImgName | ImgExt

 

If the checkbox is selected, I redirect the user to the upload page. I thought this would be a good way to do it, because the method is different when uploading something. Once they submit the form, and the check box is NOT selected, it submits info to the Article table. If they have the form checked, I want to go to a new page, and upload the image, joining the record on its respective Article ID. However, I am lost as to how to match the last ID of the article (not sure how to get the ID for that when on the next page) to give the image that's being uploaded a record to join on the images ID.

 

 

Any assistance is appreciated.

Link to comment
Share on other sites

Is this what you need?

 

http://us.php.net/mysql_insert_id

 

Yes! That looks about what I need. Thank you!

 

Another question: Would I have to set it in a Session var to get the ID on my next page?

 

[pre]

INSERT ("asdf");

 

$SubmissionID=mysql_insert_id();

 

/* or */

 

$_SESSION['logged']['upload']['SubmissionID']=mysql_insert_id();

[/pre]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.