M
M
Msim2015-11-20 01:05:58
PHP
Msim, 2015-11-20 01:05:58

Why give a uniqid() to a file if you don't refer to it later?

do$uniqid_path = _PS_UPLOAD_DIR_ . uniqid();while (file_exists($uniqid_path));
        file_put_contents($uniqid_path, $field);
        $tab = '';

The code is written when the file has already been created for a long time. How and why does it access if it is possible to easily follow it through sha1 by file name ...

Answer the question

In order to leave comments, you need to log in

2 answer(s)
E
Ernest Faizullin, 2015-11-20
@Msim

through sha1, files with the same name can be obtained. The goal is most likely that the file names do not match, and since uniqid() is not remembered anywhere, it can be assumed that the file name does not play a role here, but they are processed by some kind of cycle from the _PS_UPLOAD_DIR_ folder
or $uniq_path below is stored in the database, and so each file remembers the original path, in any case, they did "for now, what would work, and then I'll finish it"

E
Eugene, 2015-11-20
@Nc_Soft

This is probably one of the crazy ways to create a file with a unique path.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question