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

Uploading images for a mySQL / PHP database

Enthusiast ,
Nov 18, 2006 Nov 18, 2006
Hopefully this can be done - I'm working on a site that uses a simple mySQL database, where the records include an image.

I have the form to add records, including the field containing the file name - but is it also possible to upload the actual file using the same form to their folder, or does that need to be done separately using FTP software?

The idea is for my client to be able to as easily as possible add / delete / edit records himself, so clearly getting the actual images uploaded at the same point he adds records to the database would be great if that's possible.

Cheers,
Iain
TOPICS
Server side applications
741
Translate
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

correct answers 1 Correct answer

Enthusiast , Nov 19, 2006 Nov 19, 2006
Cheers - I found a site explaining what to do on the PHP page the form points to.

Iain
Translate
LEGEND ,
Nov 18, 2006 Nov 18, 2006
On 18 Nov 2006 in macromedia.dreamweaver.appdev, Iain71 wrote:

> I have the form to add records, including the field containing the
> file name - but is it also possible to upload the actual file using
> the same form to their folder, or does that need to be done
> separately using FTP software?

php.net's treatment of this is good:

http://www.php.net/manual/en/features.file-upload.php

--
Joe Makowiec
http://makowiec.net/
Email: http://makowiec.net/email.php
Translate
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
Enthusiast ,
Nov 18, 2006 Nov 18, 2006
Cheers for that - not sure exactly what I need to do tho' - it says to replace the --URL-- with a .php file, but I want the uploaded file to end up in my images folder - how do I specify it to go into there?

Iain
Translate
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
LEGEND ,
Nov 18, 2006 Nov 18, 2006
Iain71 wrote:
> Cheers for that - not sure exactly what I need to do tho'

I'm sure there are plenty of online tutorials if you Google for them. I
also cover file uploads in my new book, PHP Solutions. It's not
particularly difficult, but there are quite a few steps, and you need to
be aware of security considerations.

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
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
LEGEND ,
Nov 18, 2006 Nov 18, 2006
The PHP.NET site really covers it in considerable detail.

--
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com - Template Triage!
http://www.projectseven.com/go - DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs, Tutorials & Resources
http://www.macromedia.com/support/search/ - Macromedia (MM) Technotes
==================


"David Powers" <david@example.com> wrote in message
news:ejo4qf$ee3$2@forums.macromedia.com...
> Iain71 wrote:
>> Cheers for that - not sure exactly what I need to do tho'
>
> I'm sure there are plenty of online tutorials if you Google for them. I
> also cover file uploads in my new book, PHP Solutions. It's not
> particularly difficult, but there are quite a few steps, and you need to
> be aware of security considerations.
>
> --
> David Powers
> Adobe Community Expert
> Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
> http://foundationphp.com/


Translate
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
Enthusiast ,
Nov 19, 2006 Nov 19, 2006
Cheers - I found a site explaining what to do on the PHP page the form points to.

Iain
Translate
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
LEGEND ,
Nov 19, 2006 Nov 19, 2006
Iain71 wrote:
> Cheers - I found a site explaining what to do on the PHP page the form points to.

May I ask you for the url?

Martin
Translate
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
Enthusiast ,
Nov 21, 2006 Nov 21, 2006
The one I bookmarked to look at was this one :

link

I'm just looking at it now, but doesn't seem as straightforward as it appears, although that may have something to do with mu host.

If you google 'PHP file upload tutorial' you'll find plenty.

I still usually find it useful to post on here, as you can talk more easily if you have problems than you can with a random page or tutorial, of which there may be many, and some better than others.

Iain
Translate
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
LEGEND ,
Nov 21, 2006 Nov 21, 2006
Iain71 wrote:

> http://www.tizag.com/phpT/fileupload.php

Thank you for that
Translate
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
Enthusiast ,
Nov 21, 2006 Nov 21, 2006
Haven't managed to get it working yet unfortunately - not sure what I'm missing.

I have an upload.php page :

<html>
<head>
<title>File Upload Form</title>
</head>
<body>
This form allows you to upload a file to the server.<br>

<form action="getfile.php" method="post"><br>
Type (or select) Filename: <input type="file" name="uploadFile">
<input type="submit" value="Upload File">
</form>

</body>
</html>

and a getfile.php page :

<html>
<head>
<title>Process Uploaded File</title>
</head>
<body>
<?php

move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'],
"../uploads/{$_FILES['uploadFile'] ['name']}")

?>
</body>
</html>

And a folder 'uploads' in the same location as the 'upload.php' file.

I've tried changing '../uploads....' to 'uploads/...', but no joy.

Any ideas what I'm missing anyone?

Iain
Translate
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
LEGEND ,
Nov 21, 2006 Nov 21, 2006
Iain71 wrote:
> <form action="getfile.php" method="post">

Should be:

<form action="getfile.php" method="post" enctype="multipart/form-data">

--
David Powers
Adobe Community Expert
Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
http://foundationphp.com/
Translate
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
Enthusiast ,
Nov 21, 2006 Nov 21, 2006
LATEST
Thanks David - I had that in the first tutorial I looked at, but didn't work, then tried another.

In the end, I just needed a full path to the folder, and had to hunt around my control panel to figure out exactly what it was, but working fine now.

Iain
Translate
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