Jump to content


Photo

Renomeando Com Aspsmartupload


  • Faça o login para participar
16 replies to this topic

#1 JayJr

JayJr

    Normal

  • Usuários
  • 92 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP

Posted 24/05/2007, 06:41

Pessoal tenho o seguinte código para realizar upload de imagens que funciona perfeitamente:

<!--#include file="includes/connection.asp"-->
<%
usuario = session("usuario")

'  Variables
'  *********
   Dim mySmartUpload

'  Object creation
'  ***************
   Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

'  Upload
'  ******
   With mySmartUpload

   .Upload 

	fotoNome1 = .Files("foto_principal").FileName 
	fotoNome2 = .Files("foto1").FileName 
	fotoNome3 = .Files("foto2").FileName 
	fotoNome4 = .Files("foto3").FileName 
	fotoNome5 = .Files("foto4").FileName 


   End With 

	fotoa1			= "upload/fotos/" & fotoNome1
	fotoa2			= "upload/fotos/" & fotoNome2
	fotoa3			= "upload/fotos/" & fotoNome3
	fotoa4			= "upload/fotos/" & fotoNome4
	fotoa5			= "upload/fotos/" & fotoNome5

   '  Save the files with their original names in a virtual path of the web server
'  ****************************************************************************
mySmartUpload.Save("upload/fotos")

titulo			= mySmartUpload.form("titulo")
valor		= mySmartUpload.form("valor")
bairro			= mySmartUpload.form("bairro")
descricao			= replace(trim(mySmartUpload.form("descricao")),chr(13),"<br>")
tipo		= mySmartUpload.form("tipo")
usuario		= mySmartUpload.form("usuario")
codigo		= mySmartUpload.form("codigo")
proprietario		= mySmartUpload.form("proprietario")
contato		= mySmartUpload.form("contato")

	sql_insere = "INSERT INTO tbl_anuncios (data, cod_cliente, cod_anuncio, titulo, valor, localizacao, descricao, foto_principal, foto1, foto2, foto3, foto4, tipo, visivel, proprietario, contato) VALUES ('"& date() &"','"& usuario &"','"& codigo &"','"& titulo &"','"& valor &"','"& bairro &"','"& descricao &"','"& fotoa1 &"','"& fotoa2 &"','"& fotoa3 &"','"& fotoa4 &"','"& fotoa5 &"','"& tipo &"','s','"& proprietario &"','"& contato &"')"
	Set exe_insere = banco.execute(sql_insere)
%>
Porém com o tempo identifiquei um problema e queria renomear as fotos com um número aleatório para que não ocorra de ter fotos com o mesmo nome e acabar me dando dor de cabeça depois. O código para gerar números aleatórios é o seguinte:
Function numeros(quantidade)   
  
Dim Senha(8)   
' Declaramos a quantidade de arrays que serão criados. e seus devidos valores   
' Neste caso, criei 8 arrays com letras, isso é, nossas variáveis serão do tipo string.   
  
Senha(0) = "1"  
Senha(1) = "2"  
Senha(2) = "3"  
Senha(3) = "4"  
Senha(4) = "5"  
Senha(5) = "6"  
Senha(6) = "7"  
Senha(7) = "8"  
Senha(8) = "9"  

Randomize   
' O LEN serve para contarmos o total de caracteres de uma string   
do while len(chave) < quantidade   
num = Senha(Int(8 * Rnd ))   
chave = chave + num   
loop   
  
numeros = Trim(chave)   
' Aqui damos um valor a nossa função.   
' Usamos o TRIM, os TRIM, tira todos os espaços vazios de uma string.   
  
end function

Como que eu faço para renomear o arquivo, enviar para o servidor e gravar no banco de dados o nome do arquivo como já venho fazendo só que com o nome original do arquivo?
Procurei no fórum e só achei esse posto aqui oh: http://forum.wmonlin...=aspSmartUpload

Conto com a ajuda de vocês.

Abraços
..::::.. jay ..::::..

#2 Agente Linhares

Agente Linhares

    fuis...abraços!

  • Ex-Admins
  • 3138 posts
  • Sexo:Não informado
  • Localidade:Biritiba Mirim-SP

Posted 26/05/2007, 03:40

olha se isso resolve seu problema:
http://forums.aspfre...file-96185.html
http://p2p.wrox.com/...?TOPIC_ID=54041

se nao rolar da forma que vc quer, faça o seguinte:

- usando fso, apenas renomeie o arquivo desejado.
http://forum.imaster...o...mp;hl=%fso%
http://www.freecode....p;mode=threaded
> Busca On-line - A Busca que faltava na Internet! - Cadastre-se!
---------------------------------------------------------------------------
> BRdesign.NET - Soluções em Websites e Sistemas E-Commerce.
---------------------------------------------------------------------------
> BR-ecommerce - Sua loja virtual na internet! - Apenas R$99,90 mensais (hospedagem inclusa)!

#3 JayJr

JayJr

    Normal

  • Usuários
  • 92 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP

Posted 30/05/2007, 06:21

Muito obrigado Agente Linhares pela força, clareou bastante por aqui!

Agora eu até consigo enviar os arquivos para o servidor com nomes diferentes do original com o seguinte código:
Set objUpload = Server.CreateObject("aspSmartUpload.SmartUpload")
objUpload.Upload
For Each File In objUpload.Files
If Not File.IsMissing Then
n = n + 1
File.SaveAs "imagens/fotos/" & n & "_" & num_codigo & "." & File.FileExt
Response.Write("Arquivo <b>" & File.FileName & "</b> ")
Response.Write("(" & File.Size & "Bytes) enviado com sucesso!<br>")
End If
Next

Como que eu consiguiria gravar no banco de dados os nomes das fotos enviadas? No meu BD eu tenho os seguintes campos: foto1,foto2,foto3,foto4 e foto5.

Se alguem puder me dar mais essa ajudinha!

Valews
..::::.. jay ..::::..

#4 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 13/09/2017, 07:17

Clobetasol Website Delivered On Saturday cialis price Cytotec 200 Mcg Ciao Is 10 Mg Online Medicament Cytotec cialis Viagra Sur La Sante
How To Naturally Last Longer cialis Como Usar Viagra Kamagra Trop Cher Pfizer Vgr 100 Tetracycline 500mg cheap cialis Preise Fur Viagra
Propecia Peso cheap cialis Levitra Levitra Non Generic Viagra Online Acheter Du Viagra Gratuit cheap cialis Propecia Hirsutismo
Cialis Ou Viagra Acheter cialis online Strattera For Sale Online
Best Viagra Without. Prescription Propecia Side Effects Sperm Prescription
where to purchase discount isotretinoin no prior script overseas <a href=http://cialtobuy.com>online pharmacy</a> Kamagra Jelly Buy Online

#5 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 02/10/2017, 12:39

Levitra buy viagra online Priligy Tomar Viagra Super Active 3 8 Day Shipping Generic Valtrex Overnight Delivery

#6 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 03/10/2017, 13:40

Order Diflucan Online No Prescription viagra prescription Cialis Mejor Que Viagra Get Priligy Prescription Online Viagra Without Prescription Overnight
Why Cephalexin In Dogs viagra 20mg Levitra Cialis E Transaminasi Veterinary Amoxicillin 250mg 5ml

#7 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 13201 posts

Posted 03/10/2017, 18:02

Comprar Cialis En La Red Levitra Generico Acquisto Farmacia Buy Xenical Orlistat Canada online pharmacy Acquistare Kamagra Miglior Sito Costo Levitra In Chimica Differenza Tra Viagra E Cialis

#8 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 13201 posts

Posted 06/10/2017, 04:41

Acheter Viagra Dollar Canadien levitra generic I Want To Buy Eal Viagra Buy Lexapro Online Uk Comparaison Cialis Viagra
Levitra Scaduto vardenafil Viagra Deutschland Apotheke

#9 LarPhozyHah

LarPhozyHah

    Super Veterano

  • Usuários
  • 14515 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 12/10/2017, 16:36

Safe Online Viagra Asian Viagra levitra cheap Propecia Fotosensible Buy Priligy Cheap
Cialis 20mg No Prescription Drugstore viagra online pharmacy Non Generic Viagra Online Pharmacy

#10 Miguceamma

Miguceamma

    MiguPenjisse

  • Usuários
  • 13201 posts

Posted 13/10/2017, 06:43

Order Acetazolamide viagra Viagra Ne Shqip Baclofene Grenoble Amoxicillin Bioequivalence

#11 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 13/10/2017, 10:41

1 Mg Finasteride Side Effects Propecia Levitra Canada Kamagra Eccellente Generici Vendita Attiva levitra 20mg Amoxicillin For Cats Without Prescription Buy Doxycycline Eu Buy Tamoxifen India
Order Meds No Acript Order Zoloft Without Script viagra Cialis Brand 10mg Online Kaufen Prix Cialis Sur Ordonnance

#12 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 16/10/2017, 23:34

Tuenti Con Propecia levitra samples Buy Vardenafil 10mg
Commander Viagra Can You Drink While Taking Keflex cialis viagra levitra kaufen rezeptfrei Levitra Durata Effetto Kamagra Facts
Stendra Over Night generic levitra professional Viagra Canadian

#13 qapedlok

qapedlok

    Expert

  • Usuários
  • 509 posts
  • Sexo:Feminino
  • Localidade:Worcester

Posted 24/10/2017, 05:13

Discounts! best product websites progect11.jpg Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked! If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included). buy.png READ MORE Marrant crazy horse genuine leather bag casual men handbags men crossbody bags men's travel bag tote laptop briefcases men bags ( 98.00 $)Ulefone Future 4G Phablet-321.29 $Mercer red white checkerboard sequins sneaker ( 171.18 $) Marc JacobsBlack women wig fashion style black curly synthetic wig pure color short curly wigs shoulder length short hair wig 3091 z63 ( 32.86 $)Charming style zipper bowknot decorated maidservant uniform cosplay costume for women ( 11.18 $)High quality numbuck leather women top handbag fashion women shoulder bag warm winter women bag ( 27.00 $)Synthetic long curly wavy claw drawstring clip false ponytail natural hair extension fake tress hairpieces my ( 8.54 $)Zima blizkoUlefone Power 6050mAh Android 6.0 5.5 inch 4G Phablet FHD 2.5D Screen MTK6753 64bit Octa Core 1.3GHz Fingerprint Scanner 3GB RAM 16GB ROM 5.0MP + 13.0MP Cameras 168.59$X10 Smart Wristband Watch-43.68 $2016 Hot Ethernet Network Cable Tester Tools Kits RJ45 Crimping Crimper Stripper Punch Down RJ11 Cat5 Cat6 Wire Line Detector ( 16.29 $)DeRuiLaDy New Sexy Seamless Bra Gather Adjustable Women Bra Seamless Underwear Push Up Bra Brand Support Wholesale Free Shipping ( 12.65 $)Hot 2016 new black sexy bikini set push up strappy bikini swimsuit swimwear women bathing suit biquini swimming suit for women ( 12.98 $)Myatezhniki v Kot-dIvuare otpustili chlenov pravitelstvennoj delegaciiBlack satin pouch ( 133.30 $) Love Moschino 121bb.jpg
Discounts! hair product reviews

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
For iphone 5 5s se 6 6s 7 plus luxury ultra thin clear crystal rubber plating ( 1.99 $)
XiaoMi Silicone Rubber Case for 16000mAh Power Bank ( $2.33 )
Teclast H30 Bluetooth 4.0 Heart Rate Monitor Smart Wristband ( 17.92 $)
Funny safe bright tire tyre led spoke light lamp bike bicycle cycling car wheel valve lighting ( 0.74 $)
30pcs Motorcycle Car Tubeless Tire Puncture Repair Strips Sealer ( 4.41 $)
hot movie wall stickers kids bedroom decorations 1418. cartoon film elsa anna olaf hans home decals children girls mural art 4.0 ( 3.76 $)
New Autumn Winter Pyjamas Women Pajama Sets Cartoon nightgown for women female girl O-Neck Long Sleeve Sleepwear free shipping ( 5.60 $)
Multifunction designer backpacks women preppy bookbags mochilas mujer rivet leather backpack lady large capacity mochila escolar ( 49.94 $)
New brand ski helmet ultralight and integrally-molded professional snowboard helmet men skatingskateboard helmet multi color ( 31.57 $)
2016 women backpack fashion leather shoulder bags colorful school travel bag for teenager girls backpack mochila waterproof ( 23.99 $)
Penni Game of Thrones
Hat-Prince Protective Hard Case for MacBook Air 13.3 inch ( $8.35 )
SOOCOO S70 Ultra HD 2K Action Camera-101.68 $
Dejli, Den
Marrant genuine leather men bags hot sale male small messenger bag man fashion crossbody shoulder bag men's travel new bags 9040 ( 65.90 $)


33bb.jpg
Discounts! best beauty products in the world

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
Darth Vader Party Plastic Mask for Cosplay Gift ( $2.79 )
Bicolor dots woven silk tie ( 48.68 $) Forzieri
Black and White Double Chiffon Silk Stole ( 68.60 $)
Brazillian body wave 3 pcslot 8a brazilian virgin hair deep wave mink brazilian human hair weave bundles human hair extensions ( 99.00 $)
Small throw thread 8mm dual action random orbital car polisher buffer cleaner 220v 110v 600w gs ce emc approved ( 127.83 $)
8A Brazilian Virgin Hair Straight 3 Bundles Unprocessed Human Hair Weave Straight Brazilian Hair Mink Brazillian Straight Hair ( 51.00 $)
PZOZ For iphone 4 Cable 30 pin Charger Adapter Original USB Cabel Fast Charger For iphone 4s iphone 4 s iphone 3GS iPad 2 3 ( 1.09 $)
Cute 36 pairs round yellow happy face emoji stud earrings funny smiley earring for women girl ( 3.08 $)
Nitecore NDF40 40mm Flashlight Diffuser ( $4.59 )
Navy Leather Crossbody Bag ( 185.00 $)
ZTE A910 4G Phablet-267.05 $
Black Leather 18 kt. Gold Skull Double Wrap Bracelet ( 135.00 $)
Original IJOY Limitless RDTA Plus ( 16.40 $)
New meow alien sportswear women cycling jersey cycling clothing bike shirt size s to 2xl ( 39.99 $)
Hot New 1PC 10g-38g spinner Fishing Lure mepps metal bait Spoon Fishing Tackle Vissen Pesca Sequin Paillette Single Mustad hooks ( 2.74 $)


61bb.jpg
Discounts! best beauty products website

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
Women bag handbags tote over shoulder crossbody sling summer tassel purse suede fringe big cool female ( 9.69 $)
Screaming Retail Price Outdoor Portable First Aid Quick Slow Release Buckle Medical Military Tactical Emergency Tourniquet ( 6.43 $)
Chasti tela (teleserial)
Fashion two-tone ombre long synthetic braided hair extension for women ( 8.17 $)
Green Rose Murano Glass Drop Earrings ( 125.00 $)
Gocomma Roidmi 2S Bluetooth V4.2 Transmitter Car Charger-22.57 $
1 pcs bike lights with battery mountain road bike bicycle light lights leds tyre tire valve ( 0.49 $)
1 strandpack 4,6,8,10,12mm White Round-brilliant Turquoise Beads Jewelry Findings Bracelet Accessories For DIY Jewelry Making ( 0.80 $)
Round neck 3d old man pattern short sleeve men's t-shirt ( 11.63 $)
7A Peruvian Virgin Hair Straight 1 Bundle Peruvian Straight Virgin Hair Extension Unprocessed Peruvian Virgin Human Hair Bundles ( 12.54 $)
Kerr, Debora
Bunnylove smoke and nero mink high-heel sandal ( 331.24 $) Stuart Weitzman
Women backpack high quality pu leather mochila escolar school bags for teenagers girls top-handle backpacks herald fashion ( 17.20 $)
Brazilian curly hair weave brazilian kinky curly hair 3 bundles short curly weave for black women kinky curly hair bundles#1b ( 80.79 $)
Enjoybook &mdash; Best photo book with online ordering


226.jpg
Discounts! best gel for hair

progect11.jpg
Products which fall under this return policy can be returned domestically, as long as they are unused and in the original packaging. No questions asked!
If a product that falls under this guarantee is found to be counterfeit, you will get a full refund (shipping costs included).

buy.png

READ MORE
5.5 inch blackview e7s smartphone mt6580 quad core 2gb 16gb 1280x720 mobile phone android 6.0 fingerprint 8.0mp unlocked phone ( 69.99 $)
Kings hair factory unprocessed brazilian loose wave virgin hair 3 bundles brazilian virgin hair loose wave hair weave bundles ( 69.30 $)
Ugreen 3 5mm audio cable 90 degree right angle flat jack 3 5 mm aux cable ( 2.97 $)
Universal 2 din android 4.4 car dvd player gps+wifi+bluetooth+radio+quad core cpu+ddr3+capacitive touch screen+3g+car pc+audio ( 390.00 $)
60cm Height Large Plush Elephant Doll Toy Kids Sleeping Back Cushion Cute Stuffed Elephant Baby Accompany Doll Xmas Gift K5BO ( 31.94 $)
Casual stand-up collar short sleeve loose-fitting plaid women's blouse ( 11.32 $)
1a Prima Classe - Geo Printed Belt Pack ( 125.00 $)
Jet Set Travel Saffiano Leather Smartphone Continental Wallet ( 105.00 $)
Marina 1 Double - Turquoise Green Murano Glass and Silver Leaf Necklace ( 155.00 $)
STM32 Dual Wheel Self-balanced Video Car Robot-135.23 $
Surovoe ispitanie (film)
New luxury women handbags quality split leather ladies handbags famous brand designer women casual tote clutches bolsa femina ( 48.78 $)
New fashion brushed bird stud earrings for women classic animal bird women earrings party gift ( 0.99 $)
Solar charger power bank 12000mah portable charging powerbank external battery chargers bateria externa for iphone mobile phones ( 25.86 $)
Black suede platform boot ( 422.61 $) Proenza Schouler


71bb.jpg

#14 RonsisM

RonsisM

    Super Veterano

  • Usuários
  • 15724 posts
  • Sexo:Masculino
  • Localidade:Plovdiv

Posted 03/11/2017, 16:15

Pillole Kamagra viagra Generic Viagra Overnight Shipping

#15 HaroNism

HaroNism

    Super Veterano

  • Usuários
  • 15385 posts
  • Sexo:Masculino
  • Localidade:San Miguel de Tucuman

Posted 07/11/2017, 18:40

What Is Zithromax Used For Cephalexin Is viagra Kamagra Ou Cialis Prix
Viagra Jovenes Efectos Secundarios cialis Canada Cildentifil For Sale
Cialis 10mg Tadalafil Amoxicillin Dosage For Urinary Tract Infection viagra online prescription Propecia Side Effect
Furazolidone levitra plus Cialis Vendita Generico Smart Rx Online Amoxicillin And Dakin'S Solution
Canadianphamarcy24 Keflex And Constipation Permethrin Over The Counter Cvs cialis Levitra Generika Dosierung Cialis Original Wirkung Cialis Barcelona
Forum Sur Le Viagra viagra Amoxil Dose Calculator Propecia Side Effects In Children
Levitra Mas Alcohol Viagra Pillen Internet Biomox Amoxicillin viagra prescription Cialis Generico Dove Pulmicort Overseas Pharmacy
Real Progesterone Visa On Line What Does Keflex Treat Generic Name Propecia cialis Buy Doxycycline Us Free Shipping Cialis Achat Securise Kamagra Jelly 100mg Harbour
Propecia Low Sperm Count Stopped Buy Generic Valtrex Online Cheap levitra prices Taking Amoxicillin For Tooth Nerve
Kamagra Boite cheap cialis Zithromax Manufacturer Cialis 2




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq