Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / PHP help - copying files

Author
Message
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Feb 2004 00:13
Can anyone help me with this one...

I have installed HTMLarea, which allows you to replace text areas with an inline WYSIWYG editor. It also allows file uploads...which is where it all goes wrong

The file should be uploaded to the temp directory, then copied to the actual directory. All directories are set to 777 (Linux Apache platform). I don't think the file is even making it to the temp directory, as it's not there afterwards.

Looking at the code, I think it's using $HTTP_POST_FILES to do it's stuff, but I'm not entirely sure. The relevant chunk of code is below...



BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 20th Feb 2004 02:30
I'd love to help but need a bit more info. I had a good scout around for these type of editors a while back for a website I was doing that allowed my client to upkeep their own news pages.

Are you using the free 2.03 version? As far as I can tell uploading is not builtin to the editor but various ones are avaialble as add-ons. Which one did you go for?

On form tag, you must have following for HTTP_POST_FILES vars to work:

enctype="multipart/form-data"

Boo!
adr
21
Years of Service
User Offline
Joined: 21st May 2003
Location: Job Centre
Posted: 20th Feb 2004 14:46
I could be wrong, but I think $HTTP_POST_FILES has been superceded by the $_FILES superglobal. try replacing $HTTP_POST_FILES with $_FILES.

Keep in mind that the files are uploaded to a temporary location to which apache needs write access (normally /tmp).

if you can, die in the middle of the upload script.
die(print_r($_FILES));

should show you everything that was uploaded, and as many details as possible.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 20th Feb 2004 22:39
I'm giving up!

I cannot fathom why it's not working, my PHP knowledge is minimal.

I tried your suggestion, Adr, but it didn't make any difference.
Spooky, the enctype is correct.

I wonder if I'm using some PHP functionality that is disabled by the webhost???

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php
Martyn Pittuck
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 21st Feb 2004 13:06
Quite possibly.

Latly PHP has been getting very strict, code that worked 2 years ago will thow back many many errors, even to the most accomplished of coders.

I recently turned full debugging on, bad idea a small convention of mine is to use $array[data] when getting data, but the correct useage is $array['data']. Also fetching data from the $_POST and $_GET arrays require the use of isset() to make certain there is not an empty value!

No complaints though, i have been trying the latest betas of PHP 5 and can see where all this is heading, the latest conventions are meant to seperate the good from the great

As for ur ISP blocking stuff, have u thought of using a local server for development? I use big apache (google it) which gives Apache, PHP, MYSQL, PERL, ASP and SSL if u want it. I mirror my servers on this (MYSQL usernames and directory structures) then use it to create websites there. Much faster. Updating is just a case of making a 'website updating' page and making all visits go there, then delete all files and folders in the htdocs root and then upload the files. Delete data in the database and upload the new database.

Takes 10 mins max, and for big updates it most advised. My website is totaly dynamic, so i just need to update the database, takes 1 min max.

If u wonna have a look @ my source code MSN me; i might write a tut on it, might not, but i will always help out over msn, if i not doing ne thing important.

Whats so good about living anywho?
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 23rd Feb 2004 14:26
Cheers Martyn.

I develop locally, then upload as you suggest. But once the site is live, my client will be updating the site herself. The Article Manager will be used frequently, and this is where the problem lies. She has a full section on cards made with her products, complete with photographs.

I'm wondering if the problem is the Open Basedir restriction, as it uses the full path when uploading. I don't know if I can upload with a partial path (without the "/home/sitename/public_html/" bit), as I don't understand the underlying technology.

BatVink (formerly StevieVee)
http://facepaint.me.uk/catalog/default.php

Login to post a reply

Server time is: 2024-09-21 09:33:31
Your offset time is: 2024-09-21 09:33:31