473,407 Members | 2,314 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

download & upload script not to and from database

I have a page (html&php)from this page post this action to
<form method=post action="loadfile.php" ENCTYPE="multipart/form-data
well the loadfile.php is a script for upload file to the mysql data base and this is the code for loadfile.php
Expand|Select|Wrap|Line Numbers
  1. <?php $fold=$_REQUEST['fname'];$title=$_REQUEST['title'];$uploadedfile=$_REQUEST['uploadingfile']; $host="localhost";$user="";$pass="";$dbid="upload";$link=mysql_connect($host,$user,$pass);mysql_select_db($dbid); $path="hi/". $_FILES['uploadingfile']['name'];echo $path; move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$path); mysql_query("insert into loading(folder,title,fileload) values('$fold','$title','$path')"); mysql_close($link);  ?><?php
  2.  
  3. $fold=$_REQUEST['fname'];
  4. $title=$_REQUEST['title'];
  5. $uploadedfile=$_REQUEST['uploadingfile'];
  6.  
  7. $host="localhost";
  8. $user="";
  9. $pass="";
  10. $dbid="upload";
  11. $link=mysql_connect($host,$user,$pass);
  12. mysql_select_db($dbid);
  13.  
  14. $path="hi/". $_FILES['uploadingfile']['name'];
  15. echo $path;
  16.  
  17. move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$path);
  18.  
  19. mysql_query("insert into loading(folder,title,fileload) values('$fold','$title','$path')");
  20.  
  21. mysql_close($link);
  22.  
  23.  
  24. ?>
i want to change this code and make it upload to folder like (my upload
) on the hard disk folder's (www)

in the same thing i want to make download to my hard disk from new file named (mydownload) and this is folder existing where (appserv) already installed (www) folder

i hope to accept my best regards and best wishes
Apr 6 '10 #1

✓ answered by code green

want to change this code and make it upload to folder
Is it not a simple case of changing $path
Expand|Select|Wrap|Line Numbers
  1. move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$path); 
Not sure what you mean here
in the same thing i want to make download to my hard disk from new file named (mydownload) and this is folder existing where (appserv) already installed (www) folder
But it sounds like you will need FTP functions

6 1661
code green
1,726 Expert 1GB
want to change this code and make it upload to folder
Is it not a simple case of changing $path
Expand|Select|Wrap|Line Numbers
  1. move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$path); 
Not sure what you mean here
in the same thing i want to make download to my hard disk from new file named (mydownload) and this is folder existing where (appserv) already installed (www) folder
But it sounds like you will need FTP functions
Apr 7 '10 #2
thank u code green to replay and i hope u to continue with me

my question is : what the loadfile.php cotained and how i can to write the right
script that make this operation,,,,

my second question was : i have hyperlink for download and when click on the hyperlink download started not to data base but to any place on my computer and then showed to some description about the file like (size,type,name)
Apr 7 '10 #3
code green
1,726 Expert 1GB
what the loadfile.php cotained and how i can to write the right
script that make this operation
PHP has good file operation functions. file_get_contents() will read a file to a string which is the simplest way to output to a browser
i have hyperlink for download and when click on the hyperlink download started not to data base but to any place on my computer
To move a file you simply rename it with
Expand|Select|Wrap|Line Numbers
  1. rename (string $oldname,string $newname)
Apr 8 '10 #4
thank you code green to reply again

but please my question was :
Expand|Select|Wrap|Line Numbers
  1. <?php $fold=$_REQUEST['fname'];$title=$_REQUEST['title'];$uploadedfile=$_REQUEST['uploadingfile']; $host="localhost";$user="";$pass="";$dbid="upload";$link=mysql_connect($host,$user,$pass);mysql_select_db($dbid); $path="hi/". $_FILES['uploadingfile']['name'];echo $path; move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$path); mysql_query("insert into loading(folder,title,fileload) values('$fold','$title','$path')"); mysql_close($link);  ?><?php 
  2.  
  3. $fold=$_REQUEST['fname']; 
  4. $title=$_REQUEST['title']; 
  5. $uploadedfile=$_REQUEST['uploadingfile']; 
  6.  
  7. $host="localhost"; 
  8. $user=""; 
  9. $pass=""; 
  10. $dbid="upload"; 
  11. $link=mysql_connect($host,$user,$pass); 
  12. mysql_select_db($dbid); 
  13.  
  14. $path="hi/". $_FILES['uploadingfile']['name']; 
  15. echo $path; 
  16.  
  17. move_uploaded_file($_FILES['uploadingfile']['tmp_name'],$path); 
  18.  
  19. mysql_query("insert into loading(folder,title,fileload) values('$fold','$title','$path')"); 
  20.  
  21. mysql_close($link); 
  22.  
  23.  
  24. ?>
that scrip exist in the loadfile.php and that script let me upload the files from my page on (loacalhost) to mysql,,,,
how i can change it and make it upload not to mysql but to other place like(new folder on desktop)
Apr 9 '10 #5
code green
1,726 Expert 1GB
how i can change it and make it upload not to mysql but to other place like(new folder on desktop
Well I have already suggested FTP and rename().
What do you mean be 'change it'.
Apr 12 '10 #6
thank u it's it is clear right now
Apr 13 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Aaron | last post by:
On my website I have a dynamic link(aspx) to this file 0AX120S.jpg(privacy protection). When a visitor clicks on the link I want them to see my_vacation_pic.jpg (fetch realname from database) is...
4
by: k.mitz | last post by:
Hi, I have a PHP application that allows users to generate a .pdf report of their database content. Normally, I've had to refresh a page to call the script to generate the report, so there's a...
2
by: Ryan Taylor | last post by:
Hello. I am trying to upload a file and save it in a Sql Server 2000 database. This seems to be working fine. However, when I download the file from SQL Server, it appears that the page that is...
4
by: TC | last post by:
Hello All, I apology for posting to many groups but I wasn't sure which group would be best targeted with my question. I have inherited an ASP.Net application that requires some maintenance &...
1
by: Daniel | last post by:
Hi, can u explain to me what is the path need to use in order to upload and download the file based on below solution: 1.Set up a folder that both the web app and SQL server can get to. 2.Do a...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
4
by: abhanjee | last post by:
Hello, I am a newbie and am developing an application for work. I have figured out how to upload a file attachment to the SQL database and download the same file using C# and Visual Studio....
2
by: =?Utf-8?B?SHVzYW0=?= | last post by:
Hi EveryBody: I'm working with project in my company by using ASP.Net 2.0 that allow the users to upload and download files to web site in the internet as backup. The user will first upload his...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
1
by: chennaibala | last post by:
can any one send me mutiple image upload program and save the file name with extension in mysql table.we must cheak uploaded file type like bmp or any image file while uploading. i develop...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
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...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.