file upload help
Posted by: aks_anilsharda (202.81.207.---)
Date: July 25, 2007 06:03AM

When i upload a word document into my server via html file
upload form it gets corrupted.On other if FTP the same
document it stays fine.But other types of file
(txt,gifs) remain fine.



Anil sharda

Options: ReplyQuote
Re: file upload help
Posted by: CyberSpatium (71.237.217.---)
Date: July 25, 2007 06:48AM

make sure mod_mime is enabled in your apache httpd.conf file

c:\wamp\apache2\conf\httpd.conf



CyberSpatium
----------------------
WAMP English Forum Admin

Need help? Check out my WAMP User Manual/Guide here!


Cellular Phone Deals - The Best on the Net! - FREE PHONES! Take your pick from our featured cellular phone deals by Cingular, Verizon, T-Mobile, Sprint PCS, Nextel, and more! Most of our cellular phone offers include a FREE cellular phone with FREE shipping!


Web Development for Newbie's Blog - Check out my new blog. It is for web developers, and especially tailored for the web development newbie. If you are not fluent in “geek speak”, then this incredible resource is just you. And even if you are a web development pro, this is a great resource to check out some of the latest web development tips, news, tutorials, codes and more.


Clarify Loans
Mortgage and Home Loan Advice


LaxGo Web Directory
Powerful human edited web directory of quality, spam-free sites organized via a comprehensive category structure.

Options: ReplyQuote
Re: file upload help
Posted by: aks_anilsharda (202.81.207.---)
Date: July 26, 2007 10:14AM

yes it is on but still doc files are corrupted while uploading



Anil sharda

Options: ReplyQuote
Re: file upload help
Posted by: CyberSpatium (71.237.217.---)
Date: July 27, 2007 12:48AM

post your php code pls





CyberSpatium
----------------------
WAMP English Forum Admin

Need help? Check out my WAMP User Manual/Guide here!


Cellular Phone Deals - The Best on the Net! - FREE PHONES! Take your pick from our featured cellular phone deals by Cingular, Verizon, T-Mobile, Sprint PCS, Nextel, and more! Most of our cellular phone offers include a FREE cellular phone with FREE shipping!


Web Development for Newbie's Blog - Check out my new blog. It is for web developers, and especially tailored for the web development newbie. If you are not fluent in “geek speak”, then this incredible resource is just you. And even if you are a web development pro, this is a great resource to check out some of the latest web development tips, news, tutorials, codes and more.


Clarify Loans
Mortgage and Home Loan Advice


LaxGo Web Directory
Powerful human edited web directory of quality, spam-free sites organized via a comprehensive category structure.

Options: ReplyQuote
Re: file upload help
Posted by: aks_anilsharda (220.226.7.---)
Date: July 29, 2007 02:05PM

=============**************==========
file upload form

==============*************=============
<html>


<head>
<title>New Page 1</title>
</head>

<body>

<form enctype="multipart/form-data" method="POST" action="upload.php">
<p>upload file<input type="file" name="user_file">&nbsp; </p>
<p><input type="submit" value="Send File"></p>
<input type="hidden" name="MAX_FILE_SIZE" value="1000">
</form>

</body>

</html>

================*********************================
upload.php
================*********************================

$userfile = $_FILES['user_file']['tmp_name'];
$userfile_name = $_FILES['user_file']['name'];
$userfile_size = $_FILES['user_file']['size'];
$userfile_type = $_FILES['user_file']['type'];


if ($userfile==""winking smiley
{
echo "Problem: No file Uploaded";
exit;
}

if ($userfile_size==0)
{
echo "Zero Length";
exit;
}

//if ($userfile_type != "text/plain"winking smiley
//{
//echo "Problem: file is not plain text";
//exit;
//}
if (is_uploaded_file($_FILES['user_file']['name']))
{
echo "Problem: possible file upload attack";
exit;
}
$target_path = "uploads/";
$target_path = $target_path.basename($_FILES['user_file']['name']);
$_FILES['user_file']['tmp_name'];
if (!move_uploaded_file($_FILES['user_file']['tmp_name'], $target_path))
{
echo "Problem: Could not move file into directory";
exit;
}

echo "File uploaded successfully<br><br>";
$fp = fopen($target_path, "r"winking smiley;
//$contents = base64_encode(@fread(fopen($target_path, 'r'), filesize($target_path) ) );
$contents = fread ($fp, filesize ($target_path));
fclose ($fp);
$contents = strip_tags($contents);
$fp = fopen($target_path, "w"winking smiley;
fwrite($fp, $contents);
fclose($fp);

echo "Preview of uploaded file contents:<br><hr>";
echo $contents;
echo "<br><hr>";



Anil sharda

Options: ReplyQuote
Re: file upload help
Posted by: CyberSpatium (---.hsd1.or.comcast.net)
Date: August 01, 2007 01:46AM

turn off your firewall, anti virus, and sypware appz and try again



CyberSpatium
----------------------
WAMP English Forum Admin

Need help? Check out my WAMP User Manual/Guide here!


Cellular Phone Deals - The Best on the Net! - FREE PHONES! Take your pick from our featured cellular phone deals by Cingular, Verizon, T-Mobile, Sprint PCS, Nextel, and more! Most of our cellular phone offers include a FREE cellular phone with FREE shipping!


Web Development for Newbie's Blog - Check out my new blog. It is for web developers, and especially tailored for the web development newbie. If you are not fluent in “geek speak”, then this incredible resource is just you. And even if you are a web development pro, this is a great resource to check out some of the latest web development tips, news, tutorials, codes and more.


Clarify Loans
Mortgage and Home Loan Advice


LaxGo Web Directory
Powerful human edited web directory of quality, spam-free sites organized via a comprehensive category structure.

Options: ReplyQuote
Re: file upload help
Posted by: aks_anilsharda (202.81.207.---)
Date: August 01, 2007 09:04AM

my problem is that
users can upload files through my site...using upload form
and file uploads successfully but during upload its corrupt except .txt files.
only .txt files stores as it is but words files are not stores/upload as it is, they all corrupts.



Anil sharda

Options: ReplyQuote


Sorry, only registered users may post in this forum.