Please help me understand the big picture of allowing users to upload
pictures and keep them separate and tied to their record in the database.
I want the whole thing automated and I'm just trying to get my arms around
what all is entailed.
Each user will upload about 20 - 100 pictures and each will be related to a
different database record.
I see the process in general as this:
- when the user registers, a picture directory should be automatically
created
- user creates a record in the database using a form AND uploads a picture
for that record (how is that picture marked as related to that record?)
I'd appreciate any big picture advice AND links to code for any part of this
process.
Any security concerns? How do I handle those?
Many thanks! 2 2658
"NotGiven" <no****@nonegiv en.net> wrote in message news:<bb******* **********@bign ews6.bellsouth. net>... Please help me understand the big picture of allowing users to upload pictures and keep them separate and tied to their record in the database.
I want the whole thing automated and I'm just trying to get my arms around what all is entailed.
Each user will upload about 20 - 100 pictures and each will be related to a different database record.
I see the process in general as this: - when the user registers, a picture directory should be automatically created
mkdir($username )
- user creates a record in the database using a form AND uploads a picture for that record (how is that picture marked as related to that record?)
relate the picture however you like. you could for instance store the
path/filename in your db-record or - if you have a primary key - just
rename the picture to $primary_key.jp g.
best way in my opinion, cause it saves you having writeable
directories in your site, store the pictures in the db as well (look
at BLOB-fields).
let's suppose we uploaded the picture from a form field called 'image'
(uses mysql):
$image_string = addslashes(file _get_contents($ _FILES['image']['tmp_name']));
//convert image into a string, addslashes() to mask special chars that
mess up the query
$type = exif_imagetype( $_FILES['bild']['tmp_name']);
//find out the image type (i.e. jpg)
$query = mysql_query("IN SERT INTO table SET type = '$typ', image =
'$image_string' ");
now the db contains the image as a string. to get it out and display
it:
$ih = imagecreatefrom string($image_s tring);
switch ($type)
{
case 1: //gif
header("Content-type: image/gif");
imagegif($ih);
break;
case 2: //jpeg
header("Content-type: image/jpeg");
imagejpeg($ih);
break;
case 3: //png
header("Content-type: image/png");
imagepng($ih);
break;
}
this little script can be used in html-img-tags just like an image(img
src="this_scrip t.php")
I'd appreciate any big picture advice AND links to code for any part of this process.
Any security concerns? How do I handle those?
well, directorys where people can just automatically upload files Many thanks!
thansk!
"chotiwalla h" <ch*********@we b.de> wrote in message
news:78******** *************** **@posting.goog le.com... "NotGiven" <no****@nonegiv en.net> wrote in message
news:<bb******* **********@bign ews6.bellsouth. net>... Please help me understand the big picture of allowing users to upload pictures and keep them separate and tied to their record in the
database. I want the whole thing automated and I'm just trying to get my arms
around what all is entailed.
Each user will upload about 20 - 100 pictures and each will be related
to a different database record.
I see the process in general as this: - when the user registers, a picture directory should be automatically created
mkdir($username )
- user creates a record in the database using a form AND uploads a
picture for that record (how is that picture marked as related to that record?)
relate the picture however you like. you could for instance store the path/filename in your db-record or - if you have a primary key - just rename the picture to $primary_key.jp g.
best way in my opinion, cause it saves you having writeable directories in your site, store the pictures in the db as well (look at BLOB-fields).
let's suppose we uploaded the picture from a form field called 'image' (uses mysql):
$image_string =
addslashes(file _get_contents($ _FILES['image']['tmp_name'])); //convert image into a string, addslashes() to mask special chars that mess up the query
$type = exif_imagetype( $_FILES['bild']['tmp_name']); //find out the image type (i.e. jpg)
$query = mysql_query("IN SERT INTO table SET type = '$typ', image = '$image_string' ");
now the db contains the image as a string. to get it out and display it:
$ih = imagecreatefrom string($image_s tring);
switch ($type) { case 1: //gif header("Content-type: image/gif"); imagegif($ih); break; case 2: //jpeg header("Content-type: image/jpeg"); imagejpeg($ih); break; case 3: //png header("Content-type: image/png"); imagepng($ih); break; } this little script can be used in html-img-tags just like an image(img src="this_scrip t.php")
I'd appreciate any big picture advice AND links to code for any part of
this process.
Any security concerns? How do I handle those?
well, directorys where people can just automatically upload files
Many thanks!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Tihon |
last post by:
Hello!
I again need your help, just can't understand whats going on.
Got this upload pictures form and it's having problem handling large
files (~1.5 - 2 MB).
Everything works fine if i just upload files, like this:
copy ($myfile, $uploadfolder . "/" . $myfile_name);
Everything works fine, it can process large files and everything,
but i need to make sure that people only upload pictures, so i change
|
by: Ken |
last post by:
I am trying to upload a file to an Apache2 server on Windows 2000 Pro.
The temp file name is being added to the database.
Everything seems to work except the file is not actually transferred to the
directory. I have searched the entire hard drive for the temp file name but
it is not saved.
I have tried both defining and not defining upload_tmp_dir in PHP.ini
Both directories have had share activated.
|
by: Dean |
last post by:
First I've must say Im completly new in php scripting
What I need to do is upload, resize pictures with path in database
Here is theory of it, and plan of doing it
Hope somebody can help me
here are 4 sizes of images:
|
by: Don |
last post by:
How do I retrieve the full path (C:\.....filename) of a file uploaded to a php script on the server.
I think $_FILES will only provide 'name', which is only the filename itself.
Thanks, Don
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
|
by: Kitt Langkilde |
last post by:
Please Help.
I run my applications perfectly, can make changes to my
database, but I cannot upload Documents or Pictures Etc.
Etc.
Can anyone help me.
I was able to with my Windows ME OS. I now run Windows 2000
Kitt
| |
by: Shelly |
last post by:
I do what most programmers do -- we steal code from stuff we have written
before, or accept code from others that works, before we attempt to write
something altogether new.
On a previous project I wrote code to upload pictures and music from the
local drive to the server. It worked perfectly. I scarfed that code,
without changing any names, for a new project and I am running into a
problem. Here is what I have:
The form definition:
|
by: kev |
last post by:
Hi folks,
I have created a database to store information on equipments. During
the first level of registration, there is a form that i need the user
to fill up details on the equipment testing. i have done this one.Now
what i need is to enable the users to upload files and save it into the
corresponding table.
Example: 3. A laser inventory form has been completed for each 3b or
4 laser and submitted to the Laser Safety Officer...
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Uploading files from a local computer to a remote web server has many useful purposes, the most obvious of which is the sharing of files. For example, you upload images to a server to share them with other people over the Internet. Perl comes ready equipped for uploading files via the CGI.pm module, which has long been a core module and allows users...
|
by: dragiton |
last post by:
SA Upload SQL Database variable types (image upload and storage)
I am having trouble with the SA Upload utility. The following code used to work correctly. However, I lost my database and had to rebuild. Does anyone have any suggestions on what I may have wrong. I am not sure if I built my table to store the picture id's correctly. Maybe a field type or something.
<form name="UpdatePropertyPicture" method="POST"...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |