Jump to content

how to download file from server


janim

Recommended Posts

hi guys

i have folder for upload in my server

when some one upload his file

the sys. upload it into the folder and it's name saved too in DB

so i want to download this file by $_GET it's name

what is the problem with my code here

<?php $exte=$qry['ext']; echo "<a href='upload/$exte'>download</a>"; ?>

this will direct me to upload folder why ??

many thanks

Link to comment
https://forums.phpfreaks.com/topic/63873-how-to-download-file-from-server/
Share on other sites

 

after form submition this page will appear

<form method="post" action ="submit.php" enctype="multipart/form-data">
   <input type="hidden" name="MAX_FILE_SIZE" value="100000">
  <br />Maximum Size is 100 KB
   <input type="file" name="file" style="width: 281px" /><br />
 <span class="style6"><br />
</span>
  <input type="submit" name="submit2" value="Attach"><br />

 

as you can see this is another form to upload file then i want to insert the file name to DB for download it later you know..

 

 $file_name=$_FILES['file']['name'];
  include("config.php");   
     $link=mysql_connect($server,$datauser,$datapass)
or die("connection faild becouse".mysql_error());
mysql_select_db($database)
or die("No database selected !".mysql_error());
$insert = mysql_query("insert into $table (ext) values ('$file_name')")
or die("Could not insert data because ".mysql_error());

 

so in the DB the name is appear as i want but i think the problem in the link above

yes i have upload folder and the file is existing there

many thanks

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.