Tātad, pats sēžu pie linux mint 15 un man vajag tikt klāt ubuntu serverim, lai labotu failus un tt. Bet kā to izdarīt?
Fukzzs miniblogs
- 0
Fukzzs 02.08.2013. 20:02
Sveiki. Man ir problēma tāda, ka man links būs tāds - http://lapa.lv?gallery=galerija%1
bet kā lai noņem to %? vai varbūt var viņu kautkā aizvietot? jo tad man ar $_GET nenolasa pareizi to nosaukumu. - 0
mad 02.08.2013. 08:28
https://php.net/manual/en/function.htmlspecialchars.php - ja gribi lai parāda bet neizpilda
https://php.net/manual/en/function.strip-tags.php - ja gribi aizvākt vispār prom (bet htmlspecialchars šā vai tā vajadzētu lietot)
- 0
Fukzzs 03.02.2013. 11:10
Kāpēc šis kods man kkā divaini un nepareizi strādā. Ja saglabā kādus 3 failus vai divus. Tad viss ok. Bet kad mēģina vairāk pa 4 vai kaut kā tā. nekas nenotiek. Reku pati lapa. http://oskars.info.tm/adminpanel/showgallery?gallery=test
un kods.
<form action="showgallery.php?gallery=<?php echo $gallery ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="20000000000000" />
<input type="file" value="" name="upload[]" multiple>
<button type="submit">Upload!</button>
</form>
<?php
$gallery = $_GET['gallery'];
$error_message[0] = "Unknown problem with upload.";
$error_message[1] = "Uploaded file too large (load_max_filesize).";
$error_message[2] = "Uploaded file too large (MAX_FILE_SIZE).";
$error_message[3] = "File was only partially uploaded.";
$error_message[4] = "Choose a file to upload.";
$upload_dir = "../gallery/photos/$gallery/";
$num_files = count($_FILES['upload']['name']);
for ($i=0; $i < $num_files; $i++)
{
$upload_file = $upload_dir . urlencode(basename($_FILES['upload']['name'][$i]));
if (!preg_match("/(gif|jpg|JPG|jpeg|png)$/",$_FILES['upload']['name'][$i])) {
print "I asked for an image...";
} else {
if (@is uploaded file($_FILES['upload']['tmp_name'][$i])) {
if (@move uploaded file($_FILES['upload']['tmp_name'][$i],
$upload_file)) {
/* Great success... */
echo "hooray";
//$content = file_get_contents($upload_file);
//print $content;
} else {
print $error_message[$_FILES['upload']['error'][$i]];
}
} else {
print $error_message[$_FILES['upload']['error'][$i]];
}
}
}
?>Kods no šejienes.
- 0
Fukzzs 03.02.2013. 16:43
Sveiki. Tātad man ir kods kurš parāda visas mapes, kas atrodās vienā norādītā mapē(fukzzs/galerija/). Man šo kodu vajg savienot ar vienu citu kodu, kurš izvelk no tām visām mapītēm (no šejienes fukzzs/galerija/galerija1/) Pirmo bildi jeb failu. Ahh. ceru sapratāt to domu.
reku kods.
plss help me. :))
<?php
$gallery = $_POST['file'];
$path = "gallery11/photos/";
// Open the folder
$dir_handle = @opendir($path) or die("Unable to open $path");
// Loop through the files
while ($file = readdir($dir_handle)) {
if($file == "." || $file == ".." || $file == "index.php" )
continue;
echo "
<a href=\"showgallery?gallery=$file\">$file
<img width=100px height=100px src=" . htmlentities($file2) . " alt=Image Title Here>
</a>
<br />
";
}
// Close
closedir($dir_handle);
?>
<?php
$ctime = 0;
foreach (glob('*gallery11/photos/Lv/*.jpg') as $file)
{
if ($mtime > filemtime($file))
{
$match = $file;
$mtime = filemtime($file);
}
}
print '<img src="' . htmlentities($file) . '" alt="Image Title Here">';
?> - 0
Fukzzs 01.02.2013. 15:14
Nevarētu izveidot lūdzu pamācību kā uploadod failus uz servera? Bet ar multiple funkciju.
kad var uzreiz izvēlēties vairākus failus. Lūddzu?