Jump to content

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

1) Has the file uploaded correctly?

2) Is it in the right place (i.e. in a subdirectory called upload which is in the same file as your script

3) Have you used $qry['ext'] = $_GET['file'] to set the value of the link?

 

4) Please post more code

 

 

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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.