Jump to content


Photo

Web inaccessible folder... how to access?


  • Please log in to reply
7 replies to this topic

#1 jfee1212

jfee1212
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 26 June 2006 - 11:44 PM

I have made an upload script, and do the requirements of uploadin, the upload folder has write access.

The problem is, I want that folder to be somewhere where it can only be uploaded to by my server.

Also, (this script regards images) I need to be able to include the uploaded images in a page.

I tried using relative paths.... eg

[code=auto:0]<img src="../../uploads/imagefilename.jpg" />[code=auto:0] but that doesnt work.

Any help? do I need to do an fopen on the file?

#2 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 26 June 2006 - 11:46 PM

are you using windows?

does the folder exist uploads?

are you using a database?

post the script and form ok

if the folder uploads exist and the imagefilename exist this
will work on windows.

the uploads folder has to be in the same directory
as the php script with the below example.

<img src="uploads/imagefilename.jpg" >

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#3 jfee1212

jfee1212
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 27 June 2006 - 12:07 AM

I am developing in linux and the server is also linux.

The upload script works perfectly fine (after one slight modification), but I am not sure how to access the image.

I tried this:

echo "<div align='center'><img align='center' src='../../uploads/uploads/$image_path' /></div>";

where $image_path is the dynamically generated image path. The outputted code in the page is:

<img align='center' src='../../uploads/uploads/30.jpg' />

Which looks like it should work, however it does not. (that is the right directory by the way)

any help?

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 27 June 2006 - 12:45 AM

<img align='center' src='http://www.whatever.com/uploads/30.jpg' />

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 jfee1212

jfee1212
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 27 June 2006 - 12:47 AM

like I said, it is not in public_html so people can't use their own scripts to upload unwanted files to that folder.

../.. goes above the www.site.com, but it is not displaying the picture

#6 dptr1988

dptr1988
  • Members
  • PipPipPip
  • Advanced Member
  • 372 posts

Posted 27 June 2006 - 12:58 AM

I don't know what server you are using, but on apache you can't 'go above' the site by using relative paths. You could try making a PHP script that would read the image file from the protected directory and send it to the browser. Maybe this code can explain better:

<IMG src="get_img.php?image=30.jpg">


get_img.php
<?php

$filename = $_GET['image'];
$path = '../../uploads/';

// send the proper headers for the image with header();

readfile($path.$filename);

?>


Need more help with your project? One of the thousands of programmers, web designers or artists at <a href="http://www.rentacode...d_6764522">Rent A Coder</a> would be happy to help.

Disclaimer: Free advice is usually worth what you paid for it. ( or at least when it's coming from me! )

#7 jfee1212

jfee1212
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 27 June 2006 - 01:14 AM

the problem with that is that I am accessing the image inline with another page.

[a href=\"http://www.jafsitedesign.com/collegeartstore\" target=\"_blank\"]http://www.jafsitedesign.com/collegeartstore[/a]

the uploads file is ../../uploads/uploads relative to collegeartstore

#8 jfee1212

jfee1212
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 27 June 2006 - 04:38 PM

bump... any help?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users