Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Couple of simple questions
Old 09-14-2009, 01:56 PM Couple of simple questions
Super Talker

Posts: 113
Name: Paul
Trades: 0
I have a free php file browser and file upload script, because its free there's obviously no support from the person who wrote the code but I want to make a couple of simple changes, I only want to browse 1 directory and I only want to upload to a specific directory.

Im just struggling to understand the code, this is the browse code snippit I think I need to edit:

function showContent($path){


if ($handle = opendir($path))
{
$up = substr($path, 0, (strrpos(dirname($path."/."),"/")));
echo "<tr><td colspan='2'><img src='style/up2.gif' width='16' height='16' alt='up'/> <a href='".$_SERVER['PHP_SELF']."?path=$up'>Up one level</a></td></tr>";


I thought I'd have to add the directory I want to browse into ($path."/.") but think Im wrong

With the upload file I want to have it in /admin but upload to admin/documents:

Again this is a snippit of code I think I need to edit but please help:

<?php

$target_path = $uploadLocation . basename( $_FILES['upfile']['name']);

if(move_uploaded_file($_FILES['upfile']['tmp_name'], $target_path)) {
echo "The file: ". basename( $_FILES['upfile']['name']).
" has been uploaded!";



Thanks in advance
fattony is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-15-2009, 04:06 PM Re: Couple of simple questions
Super Talker

Posts: 113
Name: Paul
Trades: 0
thanks for the helpful posts ffs will try a different coding site
fattony is offline
Reply With Quote
View Public Profile
 
Old 09-15-2009, 04:39 PM Re: Couple of simple questions
NullPointer's Avatar
Will Code for Food

Posts: 2,784
Name: Matt
Location: Irvine, CA
Trades: 0
Quote:
Originally Posted by fattony View Post
thanks for the helpful posts ffs will try a different coding site
Believe it or not, no one sits around all day waiting to solve your problems. You should probably wait more than a day before resorting to sarcasm. Even then, if you don't get an answer its probably because:

A. no one knows of a solution
B. you didn't describe your problem well enough, or post the right information
C. someone who can help hasn't had a chance to read your thread

Remember any help you receive is free.

Anyways...

If you want to restrict the file browser to a single directory, all you need to do is set $path to that directory. The same concept applies to the file upload, all you have to do is set $uploadLocation to the path you want the file uploaded to.

In the future you should use the [ php ] tags (without the spaces) when posting code.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to Couple of simple questions
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.11896 seconds with 12 queries