hi all,
i had a page where we can upload files.so when i upload pdf,wmv,win files, they are not uploading. but the rest like txt,doc,jpeg are uploading fine.
so i need pdf,wmv,win files also upload. so can any one please...
here is my upload code. - <?php
-
ob_start();
-
@session_start();
-
require_once ("check.php");
-
createsessions($username,$password,$userid,$projectid,$projectname,$filename,$size,$allocatedmemory,$answer,$usedmemory,$Remainingmemory,$result,$data3);
-
include 'connection.php';
-
$id=$_POST[f];
-
$filename=$_FILES['uploaded']['name'];
-
$s=($_FILES['uploaded']['size']);
-
$a= round($s/1024,2);
-
$size=round($s/1024,2)." kb";
-
$answer=$_SESSION[answer];
-
$usedmemory=$_POST['usedmemory'];
-
$allocatedmemory=$_POST['data1'];
-
$remainingmemory=$_SESSION['data3'];
-
-
$query="select filename from files where filename='$filename' and projectname='$_SESSION[answer]'";
-
mysql_error();
-
$result=mysql_query($query);
-
$count=mysql_num_rows($result);
-
-
if($count=='0')
-
{
-
if($a < $remainingmemory)
-
{
-
$sql="insert into files(filename,size,uploadedby,projectname) values ('$filename','$size','$_SESSION[username]','$_SESSION[answer]')";
-
mysql_error();
-
$result = mysql_query($sql);
-
$dirname=$_SESSION[username];
-
$sql2="select reportingto from users where username='$_SESSION[username]'";
-
mysql_error();
-
$result2 = mysql_query($sql2);
-
if (mysql_num_rows($result2) > 0)
-
{
-
while($row = mysql_fetch_row($result2))
-
{
-
$admin=$row[0];
-
}
-
}
-
$dir=$admin;
-
$projectname=$_SESSION[answer];
-
if(is_dir($dirname))
-
{
-
$target = "$dir/$projectname/$dirname/";
-
$target = $target . basename( $_FILES['uploaded']['name']);
-
$ok=1;
-
if ($ok==0)
-
{
-
echo "Sorry your file was not uploaded";
-
}
-
else
-
{
-
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
-
{
-
echo "<strong style='color:green'>"."The file ". basename( $_FILES['uploaded']['name']). " has been uploaded"."</strong>";
-
-
}
-
else
-
{
-
echo " ";
-
}
-
}
-
}
-
else
-
{
-
$path="$dir//$projectname//$dirname";
-
@mkdir($path,0777,true);
-
$target = "$dir/$projectname/$dirname/";
-
$target = $target . basename( $_FILES['uploaded']['name']);
-
$ok=1;
-
if ($ok==0)
-
{
-
echo "Sorry your file was not uploaded";
-
}
-
else
-
{
-
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
-
{
-
echo "<strong style='color:green'>"."The file ". basename( $_FILES['uploaded']['name']). " has been uploaded"."</strong>";
-
}
-
else
-
{
-
echo " ";
-
}
-
}
-
}
-
}
-
else
-
{
-
echo "<strong style='color:#FF3333'>"."<left><h1>Insufficient Memory.</h1></left>"."</strong>";
-
}
-
}
-
else
-
{
-
echo "<strong style='color:#FF3333'>"."<left><h1>File with this name exist.</h1></left>"."</strong>";
-
}
-
echo "<left> <br> <input type='button' value='back' onClick='history.go(-1)'></left>";
-
-
?>
1 1375
I don't know what error you're getting but your PHP code is horrible, it's hacked together like someone took a code and modified the heck out of it:
here's one example:
What's the point of that if statement if it's always going to fail.
On related to your OP, I don't see anywhere in the code where the file time is regulated. Whatever is not letting you upload, I don't see it in your code posted above.
Good luck,
Dan
Sign in to post your reply or Sign up for a free account.
Similar topics
by: dave |
last post by:
Hello there,
I am at my wit's end ! I have used the following script succesfully to
upload an image to my web space. But what I really want to be able to do is
to update an existing record in a...
|
by: Sean Dotson |
last post by:
I have a form that passes variables to an asp file and then uploads a file.
For some reason the request.form is not getting the info from the form.
It's returning blanks. Any insight would be...
|
by: SEMIH DEMIR |
last post by:
Sitelerden birinde verilen yabancı kaynakli bir scriptti duzenledim
yanlız birseyin içinden bir turlu cıkamadım işin aslı ilk defa
persistin upload componentini kullanacam yanlız suanki haliyle...
|
by: Alex |
last post by:
I am having issues with a script to upload files from a client to a
webserver. The problem is not with the actual upload but with where it
uploads. The whole process is supposed to create a...
|
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...
|
by: pbd22 |
last post by:
hi.
i am having probs understanding how to grab a file being uploaded from
a remote client. i am using hidden input fields for upload such as:
<input id="my_file_element" type="file"...
|
by: 8anos |
last post by:
Hello,
I am new at the community and newbie at programming :)
As you may know rapidshare provides a perl script for linux, to upload files at their servers.
You can find the original scripts at...
|
by: KevinADC |
last post by:
Note: You may skip to the end of the article if all you want is the perl code.
Introduction
Uploading files from a local computer to a remote web server has many useful purposes, the most...
|
by: hotflash |
last post by:
Hi All,
I found the best pure ASP code to upload a file to either server and/or MS Access Database. It works fine for me however, there is one thing that I don't like and have tried to fix but...
|
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...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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...
|
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...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
| | |