Welcome, Guest

Neues Verzeichnis beim upload anlegen
(1 viewing) (1) Guest
  • Page:
  • 1
  • 2

TOPIC: Neues Verzeichnis beim upload anlegen

Neues Verzeichnis beim upload anlegen 2 years, 2 months ago #12745

Hallo,

ich würde gerne bei einem Formular die Daten vom upload jeweils in ein anderes verzeichnis speichern.
z.B.: ein gewisser pfad und dort für jeden upload einen neuen ordner anlegen

Ist das möglich?
  • martin5566
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0

Re: Neues Verzeichnis beim upload anlegen 2 years, 2 months ago #12800

Hallo,

dies ist über eigene Befehle unter Form Pieces - End Submit möglich.
Dort kann man mit den PHP-Befehlen wie mkdir() und move_uploaded_file() neue Ordner anlegen und die hochgeladenen Dateien dorthin verschieben.

php.net/manual/de/function.mkdir.php
de3.php.net/manual/de/function.move-uploaded-file.php

viele Grüße
Perry
Customer Care
  • perry
  • OFFLINE
  • Fresh Boarder
  • Posts: 7
  • Karma: 0

Re: Neues Verzeichnis beim upload anlegen 2 years, 2 months ago #12821

Hallo,

danke für die Antwort genau so etwas habe ich gesucht.

Aber leider bin ich eher ein Anfänger beim Programmieren, ich schaffe es nicht.

Wäre es vielleicht möglich, dass mir jemand für das erstellen eines neuen Ordners einen Beispiel-Code schreibt?
Bei mir wird kein neues Verzeichnis erstellt und ich weiß nicht wo der Fehler liegt. Ich habe den Code direkt in "Ende Übermittlung" eingetragen (funktioniert das überhaupt?) oder muss ich es über die Form Pieces (deutsch: Teile verwalten) verknüpfen? (da weiß ich nicht wie es funktioniert)

Ich sag schon mal Danke für eure Hilfe!

Martin
  • martin5566
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0

Re: Neues Verzeichnis beim upload anlegen 2 years, 1 month ago #12985

hoi

Wenn ein upload vorliegt wird ein neues Verzeichniss erstellt. (in diesem Beispiel der Ordner uploads und ein unterorder mit der User ID)


übermittlungsteile -> beginn übermittlung:

$userid = JFactory::getUser()->get('id',0);
$filename = ff_getSubmit('dein-datei-upload-feld');

if ($filename){

$path = $_SERVER['DOCUMENT_ROOT'] ."/joomla/uploads";
$dir = $userid;
mkdir($path.'/'.$dir);
}



gruß
  • Pete550
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 0

Re: Neues Verzeichnis beim upload anlegen 2 years, 1 month ago #12998

Hallo,

vielen Dank aber anscheinend bin ich zu blöd dafür.
Es funktioniert nicht. Wenn ich das richtig verstehe brauche ich nur den Namen meines Upload-Feldes eintragen und es sollte funktionieren oder?
Das einzige was ich nicht verstehe ist $_SERVER['DOCUMENT_ROOT'], was wird da abgerufen (müsste ich hier irgendetwas ändern?)

Trotzdem Danke für deine Antwort
  • martin5566
  • OFFLINE
  • Fresh Boarder
  • Posts: 5
  • Karma: 0

Re: Neues Verzeichnis beim upload anlegen 2 years, 1 month ago #13025

Hast du
$this->execPieceByName('ff_InitLib');
mit eingefügt?
einfach als erstes vor dem anderen code eintragen.

$_SERVER['DOCUMENT_ROOT'] ist dein root-Verzeichnis deines Webhosters.
Das kannst du alles so stehen lassen.
joomla/uploads wäre das neu angelegte Verzeichniss in deinem Webspeicher.

Prüfe auch ob der Name / Titel deines Upload Feldes stimmt!!!
$filename = ff_getSubmit('Name-deines-Upload-Feldes');

gruß
  • Pete550
  • OFFLINE
  • Fresh Boarder
  • Posts: 11
  • Karma: 0
  • Page:
  • 1
  • 2
Moderators: TheMuffinMan, ForumSupport
Time to create page: 0.94 seconds

Facebook Discount - 40% Off!

Fans of our Facebook page here are entitled to get a 1-year-subscription for the price of a 6-months!

Steps to take:

  • Become a fan on Facebook (Like) here
  • Purchase a 6-months-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of your like and we'll upgrade to the 1-year-subscription

Joomla!® Forms Discount - 40% Off!

Already purchased a forms extension from a different vendor but your requirements changed and now you need a forms extension that is capable of more than just the standards? We help you to keep the costs for a change under control: Get a 40% discount on our professional membership plan! -- meaning timely unlimited access to all current and future commercial extensions, breezingforms themes & apps and Joomla!® templates at crosstec.de, including 1 year of support -- without any website limitations -- Just prove that you previously purchased another forms extension for Joomla!® from a different vendor and you are qualified.

Steps to take:

  • Purchase a 1-year-subscription from here
  • Write a quick email to This email address is being protected from spambots. You need JavaScript enabled to view it. with your username and prove of the purchase for the other form vendor and we'll upgrade to the professional-subscription

About

Crosstec GmbH & Co. KG

Bergisch-Gladbacher-Str. 829

51069 Cologne, Germany

Imprint