473,748 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Uploading Files: Definitive answer required. ;-)

Hi there.

I've spent the weekend getting ever more frustrated, trying to get an
upload file function working on a website.

The site is hosted by a company called oneandone. They're using PHP 4.2.
3, not in safe mode. I think that the basic problem is the set-up for
the temp folder, but I don't have access to the .ini settings.

I'm pretty sure it's possible, because I've got MyPHPAdmin running, and
it's happily accepting uploaded files (although I can't make head nor
tail of their code).

I've read through the manuals online (most of which assume 'it just
sorta works' or that you have access to the .ini files), and I've tried
setting the values for upload_tmp_dir using ini_set() but I just can't
get it to work.

Here's the code I'm stuck with at the moment...

file 1: upload.php

****

<?php
$root = $HTTP_SERVER_VA RS['DOCUMENT_ROOT'];
ini_set('upload _tmp_
dir', $root.'tmp');
?> <html>
<head>
<title>Administ ration - file
upload</title>
</head>
<body>
<h1>Upload new files</h1>
<form
enctype="multip art/form-data" action="upload2 .php" method="post">

<input type="hidden" name="MAX_FILE_ SIZE" value="1000000" >
Upload
this file: <input name="userfile" type="file">
<input type="submit"
value="Send File">
</form>
</body>
</html>

***

file 2: upload2.php

***
<?php
$root = $HTTP_SERVER_VA RS['DOCUMENT_ROOT'];
ini_set('upload _tmp_
dir', $root.'tmp');
?> <html>
<head>
<title>Uploadin g...</title>
</
head>
<body>
<h1>Uploading file...</h1>
<?php
echo 'Document
root is '.$root."<br />\n";
echo 'Upload directory: '.ini_get('uplo ad_
tmp_dir')."<br />\n";
echo 'Upload directory: '.get_cfg_var(' upload_tmp_dir' )."\n";
?>
</body>
</html>

***

(I realise that this doesn't actually do any uploading, but I've rolled
it back as far as I can, as a follower of a walk then run school of
philosophy, just to get it to tell me where it might deign to upload
stuff, were it to work ;-) )

When I execute these two pages, the second page just coughs up a blank
Upload directory, as if it hasn't been set. Can somebody please point
me in the right direction?!?!? My desk is starting to get a forehead
shapped dent in it... I just want to upload some plain text files and a
few 4k jpgs for goodness sake!

Aaarrrgh.
Thanks.

dd
Jul 17 '05 #1
4 2778
Wil
I've been looking at stuff all weekend on googlegroups and I've come
to the conclusion that on shared servers you can't alter
upload_tmp_dir using ini_set().
Jul 17 '05 #2
Wil wrote:
I've been looking at stuff all weekend on googlegroups and I've come
to the conclusion that on shared servers you can't alter
upload_tmp_dir using ini_set().


That's the same conclusion you'd reach by reading ini_set on the manual
:)

http://www.php.net/ini_set
The info for "upload_tmp_dir " on the "Changeable " column has
"PHP_INI_SYSTEM " wich is specified as "Entry can be set in php.ini or
httpd.conf"
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
Jul 17 '05 #3
jn
"Pedro Graca" <he****@hotpop. com> wrote in message
news:c1******** *****@ID-203069.news.uni-berlin.de...
Wil wrote:
I've been looking at stuff all weekend on googlegroups and I've come
to the conclusion that on shared servers you can't alter
upload_tmp_dir using ini_set().


That's the same conclusion you'd reach by reading ini_set on the manual
:)

http://www.php.net/ini_set
The info for "upload_tmp_dir " on the "Changeable " column has
"PHP_INI_SYSTEM " wich is specified as "Entry can be set in php.ini or
httpd.conf"
--
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--


Did you try putting something like this in an .htaccess file?

php_value upload_tmp_dir /whatever/dir/you/want
Jul 17 '05 #4
On Mon, 02 Feb 2004 14:17:56 +0000, dickiedyce wrote:
Hi there.

I've spent the weekend getting ever more frustrated, trying to get an
upload file function working on a website.

The site is hosted by a company called oneandone.

Oops! ;)

They're using PHP 4.2.
3, not in safe mode. I think that the basic problem is the set-up for the
temp folder, but I don't have access to the .ini settings.

I personally think the issue is elsewhere...

I'm pretty sure it's possible, because I've got MyPHPAdmin running, and
it's happily accepting uploaded files (although I can't make head nor tail
of their code).

I'd say it's uploading fine (assuming your account isn't more restricted
than wherever phpMA runs).

I've read through the manuals online (most of which assume 'it just sorta
works' or that you have access to the .ini files), and I've tried setting
the values for upload_tmp_dir using ini_set() but I just can't get it to
work.

I have to ask.. why?

Why are you trying to change the temp upload dir? What's wrong with the
current one?

Here's the code I'm stuck with at the moment...

[ snip code with no code to process uploaded file ]

(I realise that this doesn't actually do any uploading, but I've rolled it
back as far as I can, as a follower of a walk then run school of
philosophy, just to get it to tell me where it might deign to upload
stuff, were it to work ;-) )

When I execute these two pages, the second page just coughs up a blank
Upload directory, as if it hasn't been set. Can somebody please point me
in the right direction?!?!? My desk is starting to get a forehead shapped
dent in it... I just want to upload some plain text files and a few 4k
jpgs for goodness sake!

Aaarrrgh.

Did you move the uploaded file to your specified dir before the end of the
script finished executing? You've shown no code that would deal with this.

When a file is uploaded, it's stored in the $TEMP dir as something like:
php87Dkdfs9
You then use something like 'move_upload_fi le()' to put this into
$YOUR_CHOSEN_PA TH as $YOUR_DEFINED_F ILENAME.

If you already have this code present but didn't post it here, if you
could post the section maybe it can be analysed better (I'm not saying
this _is_ the problem, but without seeing anymore of your code, it's my
first suspect).

Regards,

Ian

--
Ian.H
digiServ Network
London, UK
http://digiserv.net/

Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2825
by: Chamomile | last post by:
can anyone point me to some straightforward information on file uploading without using an html form? That is, direcly from within a php script. if I know the local path etc. to a particular requested file how can I send it directly to a location on a remote webserver following a request from the remote server? The motivation is that I have a large number of image files that are
1
1794
by: Jim Mitchell | last post by:
I have a rather simple project with several ASPX files. If I make a change to one of the files, can someone tell me the least I need to do to update my project on the server. Right now I am rebuiding the entire project, copying the to a directory and uploading all the files required to run the app to the server. Thanks in advance.
18
1590
by: xarax | last post by:
Greetings, What is the general practice, usual and customary way, of including a data file into a source file? I have some large data structures defined as source similar to: ========================= typedef struct fubar
3
1975
by: deko | last post by:
Newbie ASP.NET question: Now that I've created an ASP.NET site, how to I get it to my hosting provider? I've developed sites with Dreamweaver MX in the past - with Dreamweaver, it's very easy. The ability to link to the remote site (via FTP) is built into the IDE and all you have to do is click upload. Does Visual Studio have a similar feature? How do most people deploy their sites to a remote server from Visual Studio?
13
4317
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming that this is suppossed to end up as a component for others to use, and therefore I do NOT have access to their global.cs::Session_End() how do I cleanup files that were uploaded -- but obviously left stranded when the users aborted/gave up writting...
5
3153
by: hecuba007 | last post by:
My apologies if this question has been asked before .. I would like to split large files into smaller chunks for uploading to php for re-assembly on the server. Is there a (relatively) simple way of doing this in javascript? If so, could someone point me to relevant documentation to read or (if really simple!) give me some coding hints? Thanks.
5
2727
by: Chris | last post by:
I have a meetings section I'm developing on our intranet. Using PHP/MySQL. Meeting info and Meeting docs reside on 2 related tables in the db. Users may want to upload anywhere from 1 to 10 or more documents to share/use during a meeting presentation. What would be the most efficient way to approach this? This is the logic I'm currently considering: Page 1: Meeting Information input with link to a document upload page (this page...
0
1504
by: PerumalSamy | last post by:
Hi, I am getting following error while uploading my project in web. Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: File or assembly name CrystalDecisions.CrystalReports.Engine, or one of its dependencies, was not found. Source Error:
221
367602
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application needs to store entire files, the preferred method is to save the file onto the server’s file-system, and store the physical location of the file in your database. This is generally considered to be the easiest and fastest way to store files. ...
0
9552
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9376
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9326
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4877
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.