Hello and thank you.
Could you please help me with this.:
i try to store images using the following code,
and it just bring a blank screen.
i being trying different things and i am not sure if the problem is on values.
Please help me. PUT YOUR CODE WITHIN code OR php TAGS NEXT TIME!!!! -
<body>
-
<form action="insert2.php"method="post" enctype="multipart/form-data">
-
Select Image File: <input type="file" name="userfile" size="40"><input type="submit" value="submit">
-
</form>
-
-
=======
-
insert2.php:
-
-
</body>
-
<body>
-
<?php
-
$conn = mysql_connect("localhost", "root")
-
OR DIE (mysql_error());
-
@mysql_select_db ("image", $conn) OR DIE (mysql_error());
-
-
// Do this process if user has browse the
-
// file and click the submit button
-
if ($_FILES) {
-
$image_types = Array ("image/bmp",
-
"image/jpeg",
-
"image/pjpeg",
-
"image/gif",
-
"image/x-png");
-
if (is_uploaded_file ($_FILES[“userfile”][“tmp_name”])) {
-
$userfile = addslashes (fread
-
(fopen ($_FILES["userfile"]["tmp_name"], "r"),
-
filesize ($_FILES["userfile"]["tmp_name"])));
-
$file_name = $_FILES["userfile"]["name"];
-
$file_size = $_FILES["userfile"]["size"];
-
$file_type = $_FILES["userfile"]["type"];
-
if (in_array (strtolower ($file_type), $image_types)) {
-
$sql = "INSERT INTO image "
-
. "(image_type, image, image_size, image_name, image_date) ";
-
$sql.= "VALUES (";
-
$sql.= "'{$file_type}', '{$userfile}', '{$file_size}', "
-
. "'{$file_name}', NOW())";
-
@mysql_query ($sql, $conn);
-
Header("Location:".$_SERVER["PHP_SELF"]);
-
exit();
-
}
-
}
-
}
-
</body>
PUT YOUR CODE WITHIN code OR php TAGS NEXT TIME!!!!
1 6641
Before going into this, some questions:
- what have you done to isolate the problem?
- have you put traces in (such as echo's)?
- until what point in your code is everything processing ok?
Ronald :cool:
Sign in to post your reply or Sign up for a free account.
Similar topics
by: cover |
last post by:
The question is,
we have two options to store images, either in a Database (MySQL,
Postgres, ...) like blob data, or in the hard disk the file and the path in database.
Which option is better?...
|
by: Universal |
last post by:
store Images (or any Binary Data) to a SQL Server database using VC++
Can anybody help me in this
Thanks in advance
|
by: DL |
last post by:
Hi,
Many questions have already been asked and answered about images in
Access... But despite having searched, I have not found an answer to
the following question...
In my DB, several forms...
|
by: Tim Zych |
last post by:
How would I go about storing data files on my web host?
I have an Access database driven website and I would like to save files and
be able to download them. Can somebody point me in the right...
|
by: john_20_28_2000 |
last post by:
Using asp.net, c#, mysql or SQL Server. I have a image uploading and
wanted it to be "secure." Each user has their own section to login and
upload images. Should I store the images in a database...
|
by: Rudy |
last post by:
Hello all!
I am amazed how many posts I have read to store an image in SQL, and just as
many against it. So I learned how to store an image in a SQL db and retrieve
the image. A little tricky,...
|
by: Skiran |
last post by:
Hi to everybody,
I am handling a large-scale project of MIS (Marketing information System). I am using Vb 6 as front end, Ms Access as back
end and Crystal report 8 as reporting tool.
1)...
|
by: vunet.us |
last post by:
I want to know if this practice is effective and secure:
I have been thinking about storing some data, which my users upload,
in text files rather than database, since often I do not know how much...
|
by: Keith Hughitt |
last post by:
Hi all,
I've run into a strange error while trying to store some PNG images in
a MySQL database using MySQLdb. When I try to insert smaller images (<
64kb or so) everything seems to work fine....
|
by: gm000 |
last post by:
hi
i m using radiobuttonlist with images like this
<asp:RadioButtonList ID="rbtnthumb1" runat="server">
<asp:ListItem Value ="News_icon.jpg">
<img...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
|
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...
| |