/    Sign up×
Community /Pin to ProfileBookmark

two questions concerning uploads …

Hello everybody,

I have 2 problems.
I would like people to upload their files on my site. The problem is that my site is divided in two. The first one is the one the users see, the second is a “secret” one where the files are stored. I have a script that works really nice to upload file from the “users” site to the “users” site. However, I cannot manage to get my upload form on my “users” site and have the file uploaded on my “secret” site …
My second problem is that my script works well for zip file but strangely enough, not for rar files, any idea why ?

Thank you so much for your time and help !

here is my script :

[code=php]<?php
if ((($_FILES[“file”][“type”] == “application/zip”)
|| ($_FILES[“file”][“type”] == “application/rar”))
&& ($_FILES[“file”][“size”] < 200000))
{
if ($_FILES[“file”][“error”] > 0)
{
echo “Return Code: ” . $_FILES[“file”][“error”] . “<br />”;
}
else
{
echo “Upload: ” . $_FILES[“file”][“name”] . “<br />”;
echo “Type: ” . $_FILES[“file”][“type”] . “<br />”;
echo “Size: ” . ($_FILES[“file”][“size”] / 1024) . ” Kb<br />”;
echo “Temp file: ” . $_FILES[“file”][“tmp_name”] . “<br />”;
if (file_exists(“upload/” . $_FILES[“file”][“name”]))
{
echo $_FILES[“file”][“name”] . ” already exists. “;
}
else
{
move_uploaded_file($_FILES[“file”][“tmp_name”],
“1/” . $_FILES[“file”][“name”]);
echo “Stored in: ” . “1/” . $_FILES[“file”][“name”];
}
}
}
else
{
echo “Invalid file”;
}
?>[/code]

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@BuezaWebDevFeb 14.2007 — [1] Uploading rars

-- Have you tried using the content type "application/x-rar-compressed" instead of application/rar ?

[2] Uploading for both sites

-- Have you thought about using a database to store the zip/rar files as binary? That way, you'll have a central data source where both your websites can pull information from.

-- Are both the user site and "secret" site on the same server?
Copy linkTweet thisAlerts:
@pcollomauthorFeb 14.2007 — 1- yep, no luck there.

2- well, in my idea, I would store the file on one site and use the other to pull them out.

3- nope.

Now, I am in trouble ...
×

Success!

Help @pcollom spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...