?
Solved

php image upload

Posted on 2011-10-08
4
Medium Priority
?
325 Views
Last Modified: 2012-05-12
Hi Experts,

I am fairly new to this...

I have got this php script from http://www.webmotionuk.co.uk/php-jquery-image-upload-and-crop/

I have made some modifications to the form at the bottom of the attached file.

I would like to do the following...

1) generate a unique id in the unique id field
2) upload the form results to 'gallery' table
3) rename and upload the image with the 'unqiue id' as the filename

can any one help me please! im tearing my hair out!
0
Comment
Question by:maccaj51
  • 2
  • 2
4 Comments
 

Author Comment

by:maccaj51
ID: 36935825
0
 
LVL 111

Accepted Solution

by:
Ray Paseur earned 2000 total points
ID: 36938530
This is really three questions.  I doubt if I can work on your code but here are some ideas that may help you get started.

1.  The PHP.net web site has good instructions that teach how to upload an image and information from a form.
http://www.php.net/manual/en/features.file-upload.php
http://www.php.net/manual/en/features.file-upload.post-method.php
http://www.php.net/manual/en/features.file-upload.errors.php
http://www.php.net/manual/en/features.file-upload.common-pitfalls.php
http://www.php.net/manual/en/features.file-upload.multiple.php

2. You can generate a unique name by using the md5() digest of the image file.  You might also associate it with the date and time, or the client who uploaded the file.
http://www.php.net/manual/en/function.md5.php

3. After the file is uploaded and the unique name is generated, you need to put it some place for permanent storage.
http://www.php.net/manual/en/function.move-uploaded-file.php

HTH, ~Ray
0
 

Author Closing Comment

by:maccaj51
ID: 36938596
Thanks Ray that helped alot!
0
 
LVL 111

Expert Comment

by:Ray Paseur
ID: 36938612
Thanks for the points - it sounds like an interesting application.  There are a lot of moving parts here, but if you go at it one step at a time you'll get great results. ~Ray
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month17 days, 1 hour left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question