Re: mkdir no such file or directory [message #181429 is a reply to message #181410] |
Wed, 15 May 2013 23:20 |
Bhushan N.N
Messages: 7 Registered: May 2013
Karma:
|
Junior Member |
|
|
Thomas,
Thanks for your feedback.
I just put that uploads/time format as an example. In the real application I will be using
uploads/<username>/time format
Please learn how to post properly? Don't really know what you mean. Thanks a lot anyway for your help. Appreciate it.
Thank you
Bhushan
On Wednesday, 15 May 2013 10:37:15 UTC-6, Thomas 'PointedEars' Lahn wrote:
> Bhushan N.N wrote:
>
>
>
>> ie, if my website is called example, the structure will be
>
>>
>
>> example
>
>> index.php
>
>> upload.php
>
>> search.php
>
>> uploads
>
>> 12209214
>
>> somefile.txt
>
>> 31231203
>
>> otherfile.txt
>
>> about.php
>
>> contact.php
>
>
>
> Please learn how to post properly on Usenet. Avoid Google Groups in favor
>
> of a locally installed newsreader application if possible.
>
>
>
> The problem here is that you are falsely assuming that “/” refers to the
>
> document root. Instead, it refers to the *filesystem* root, where you/the
>
> Web server SHOULD NOT have write access. As “uploads” is a directory on the
>
> same level as upload.php, it is probably easiest for you just to omit the
>
> leading “/”.
>
>
>
> However, it would be safest to refer to the document root explicitly, like
>
>
>
> $_SERVER['DOCUMENT_ROOT'] . '/uploads/' . $value
>
>
>
> (As you can see, it does not make sense to concatenate '/uploads' . '/' when
>
> you can just write '/uploads/'.)
>
>
>
> It also does not make a lot of sense to create a directory for every second
>
> of upload since epoch, using time(). If you need to group uploads by date
>
> for quick access, I suggest you use year/month/date instead. That said, you
>
> can rather easily filter an array of file information, so unless there is a
>
> chance that on different times people would upload files with the *same*
>
> name where they do *not* want to overwrite the old version, you do not need
>
> that directory structure.
>
>
>
> However, in a multi-user application another piece is missing in any case:
>
> You need a way to differentiate between the files of users or one user could
>
> overwrite the file of another. Using time() _cannot_ prevent that from
>
> happening, because there is the possibility of concurrent access.
>
>
>
>
>
> PointedEars
>
> --
>
> Anyone who slaps a 'this page is best viewed with Browser X' label on
>
> a Web page appears to be yearning for the bad old days, before the Web,
>
> when you had very little chance of reading a document written on another
>
> computer, another word processor, or another network. -- Tim Berners-Lee
|
|
|