Upload-file (Word.doc) in Dreamweaver

Thread Solved

Join Date: Jul 2008
Posts: 3
Reputation: xsmedia is an unknown quantity at this point 
Solved Threads: 0
xsmedia xsmedia is offline Offline
Newbie Poster

Upload-file (Word.doc) in Dreamweaver

 
0
  #1
Jul 10th, 2008
Can anyone help me with a upload-file function using Dreamweaver. I'm a real novice and would appreciate any help applying this function to pages created in Dreamweaver - server-side script, how to apply it and generally what I need to do.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: Upload-file (Word.doc) in Dreamweaver

 
0
  #2
Jul 10th, 2008
So are you saying that you already have an upload script but dont know how to implement?
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 3
Reputation: xsmedia is an unknown quantity at this point 
Solved Threads: 0
xsmedia xsmedia is offline Offline
Newbie Poster

Re: Upload-file (Word.doc) in Dreamweaver

 
0
  #3
Jul 11th, 2008
No. I've just created the base design in Dreamweaver, and created the form with upload button, but now I need some 'server-side' script to make it work. And the help option and Adobe support is useless! Appreciate any advice.
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 596
Reputation: buddylee17 has a spectacular aura about buddylee17 has a spectacular aura about 
Solved Threads: 125
buddylee17's Avatar
buddylee17 buddylee17 is offline Offline
Posting Pro

Re: Upload-file (Word.doc) in Dreamweaver

 
0
  #4
Jul 11th, 2008
In dreamweaver, create a new php file. Clear all of the code out of the code view. Now click toggle plain text, copy and paste all of the following into dreamweaver:
  1. <?php
  2. if(isset($_POST['submit'])){
  3. $numfilesuploaded = $_POST['numuploads'];
  4. $count = 1;
  5.  
  6. while ($count <= $numfilesuploaded)
  7. {
  8. $conname = "new_file".$count;
  9.  
  10. $filetype = $_FILES[$conname]['type'];
  11.  
  12. $filename = $_FILES[$conname]['name'];
  13. if ($filename != '')
  14. {
  15. if ($filetype == "application/msword" || $filetype=="application/vnd.openxmlformats-officedocument.wordprocessingml.document")
  16. {
  17. $maxfilesize = $_POST['maxsize'];
  18. $filesize = $_FILES[$conname]['size'];
  19. if($filesize <= $maxfilesize )
  20. {
  21. $randomdigit = rand(0000,9999);
  22.  
  23. $newfilename = $randomdigit.$filename;
  24. $source = $_FILES[$conname]['tmp_name'];
  25. $target = "files/".$newfilename;
  26. move_uploaded_file($source, $target);
  27. echo $count." File uploaded | ";
  28.  
  29.  
  30. }
  31. else
  32. {
  33. echo $count." File is too big! 10MB limit! |";
  34.  
  35. }
  36. }
  37. else
  38. {
  39. echo " The file is not a supported type |";
  40. echo $filetype;
  41. }
  42. }
  43. $count = $count + 1;
  44. }
  45.  
  46. }
  47. ?>
  48. <?php
  49. $numuploads = 1;
  50. $count = 1;
  51. ?>
  52. <form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm">
  53. <?php
  54. while ($count <= $numuploads)
  55. {
  56.  
  57. ?>
  58. <input name="new_file<?php echo $count; ?>" id="new_file<?php echo $count; ?>" size="30" type="file" class="fileUpload" />
  59. <?php
  60. $count = $count + 1;
  61. }
  62. ?>
  63. <input type = "hidden" name="maxsize" value = "10240000">
  64. <input type = "hidden" name="numuploads" value = "<?php echo $numuploads; ?>">
  65. <br>
  66. <button name="submit" type="submit" class="submitButton">Upload Files</button>
  67.  
  68. </form>
Name the above file uploader.php
Move the file to your server. In the same directory as the uploader.php file, create a new folder and name it files. Now go into your browser and test the uploader.php file.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 3
Reputation: xsmedia is an unknown quantity at this point 
Solved Threads: 0
xsmedia xsmedia is offline Offline
Newbie Poster

Re: Upload-file (Word.doc) in Dreamweaver

 
0
  #5
Jul 16th, 2008
Many thanks, much appreciated. I will give it a go, but as said, my background in print design and not web. I've no problem creating static pages, but when it comes to the back-end stuff, I'm pretty much lost. As soon as I've got it going, I will ping you back. Creating a php file in Dreamweaver is pretty straight forward I guess? Regards.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 2
Reputation: dsaunlimited is an unknown quantity at this point 
Solved Threads: 1
dsaunlimited dsaunlimited is offline Offline
Newbie Poster

Re: Upload-file (Word.doc) in Dreamweaver

 
0
  #6
Jan 26th, 2009
Thank you for this info. I think I am close but how do I created the submit button so the file will upload?
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 2
Reputation: dsaunlimited is an unknown quantity at this point 
Solved Threads: 1
dsaunlimited dsaunlimited is offline Offline
Newbie Poster

Re: Upload-file (Word.doc) in Dreamweaver

 
0
  #7
Jan 26th, 2009
Disregard. I figured it out. Thanks.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 2
Reputation: baccuss is an unknown quantity at this point 
Solved Threads: 0
baccuss baccuss is offline Offline
Newbie Poster

Re: Upload-file (Word.doc) in Dreamweaver

 
0
  #8
Sep 30th, 2009
My GOODNESS !!!! I've been searching for an answer to this problem for a week and I've finally found it.

buddylee17 YOU ARE THE MAN !!!!

I just joined the site & am looking forward to sharing with you. Thanks a Million
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Graphics and Multimedia Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC