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

Uploading file system required

Contributor ,
Jul 12, 2009 Jul 12, 2009

I would like to be able to offer contributors to my site a way of uploading Word.docs or .pdf files and forwarding them to me by email. Obviously they can just send me an email with an attachment, but it would be neater, and more likely to happen I think, if it could be done from a "Browse", "Upload", "Send" form on the webpage.

Any suggestions as to how I can achieve this, please?

(Security risks are slight as contributors will already have entered a password protected area.)
(Although I have no great knowledge of php it is the system I tend to use with html.)

TOPICS
Server side applications
1.3K
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
Advisor ,
Jul 13, 2009 Jul 13, 2009

Asked and answered many times. Have you looked here?

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
Guest
Jul 13, 2009 Jul 13, 2009

Well, if u are using PHP then u can use this thread HERE which I have discussed long time ago. In fact, you just need to modify the code to accept .doc and .pdf file only.

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
Contributor ,
Jul 13, 2009 Jul 13, 2009

Thank you QiQi86, but I do not think I need to upload into a Database to achieve what I want.

I am looking around the various suggestions that been offered in the past.

I am using a rather old DWMX2004 and wonder if CS4 has the facility for setting up a simple uploader within its arsenal of faciliies?

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
New Here ,
Jul 13, 2009 Jul 13, 2009

Generally this is not a good idea.  Usually what is done is to have the file's path in the data base.  There is a lot of overhead when embedding a files in databases.

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
Guest
Jul 13, 2009 Jul 13, 2009

From that thread, actually u just store the file path in database while the uploaded file will  be in server. So it will save database space.

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
Advisor ,
Jul 13, 2009 Jul 13, 2009
LATEST

Heya smiffy,

You could do it without a database and just upload the file to your server using a script and use the post value or session variable of the file name to send an email. But you could not send the attachment after closing the browser or logging out because you would destroy the session with the file name stored in it.

To create a session variable for your file field add a file field to a form with method="POST" name the file input field something like uploaded_file then on your form "action" page (the page where your file upload script is located) add this code to store the POST value of the file input field in a session variable

<?php
session_start();
session_register("file");
$file = $_POST['
uploaded_file'];
?>

You will now have a session variable $file for the uploaded file and you can send an email using a script while you are logged onto the site. You could also just consolidate the upload script and send email script into one and you would not need to create a session variable for the filename. The only reason you need to create a session variable is if you are using the POST method and the email script is on a separate page from the form submit script because POST values are only retained for one page then they are destroyed so to keep the POST value of the uploaded filename throughout the site visit you would need to create a session variable for the filename.

If you wanted your users to be able to upload a file in one visit and then send the file in an email from the website upon revisiting the site after closing the browser then you would need to save the filename in a database. If it's a one time transaction where the user uploads a file and sends it in an email then you could create a session variable for the filename and send the uploaded file in an email from the site while the session is active.

As you can see there are lots of options. Find a method that you think will work for you and try to make it work.

Good luck!

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